<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Revolves &#187; C++</title>
	<atom:link href="http://www.revolves.net/category/programming/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.revolves.net</link>
	<description>Innovation</description>
	<lastBuildDate>Tue, 27 Dec 2011 15:25:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Learning C Programming &#8211; Why and How</title>
		<link>http://www.revolves.net/learning-c-programming-why-and-how/</link>
		<comments>http://www.revolves.net/learning-c-programming-why-and-how/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 17:38:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.revolves.net/?p=477</guid>
		<description><![CDATA[C might sound like the language of programming wizards. Normally, the current generation of programming beginners have an array of high level languages like Ruby, Python and PHP to work with. Working with Java+(Some GUI Library) or .NET seems more intuitive. So, why learn C? And if you&#8217;re convinced that it&#8217;s a good language to [...]]]></description>
			<content:encoded><![CDATA[<p>C might sound like the language of programming wizards. Normally, the current generation of programming beginners have an array of high level languages like Ruby, Python and PHP to work with.</p>
<p>Working with Java+(Some GUI Library) or .NET seems more intuitive. So, why learn C? And if you&#8217;re convinced that it&#8217;s a good language to learn, then how should you go about learning it?<span id="more-477"></span></p>
<h2>Why learn C in this ultra-modern world?</h2>
<p>Well, the world seems ultra-modern because most of the tools that make it ultra-modern are written in C.</p>
<p>C is primarily used to do systems level programming &#8211; writing operating systems and other lower level stuff.</p>
<p>Even though you have a standard library with C, it&#8217;s not much compared to that of Python, which even gives you XML support out of the box.</p>
<p>If you&#8217;re hacking a script together to do some little stuff here and there, then it makes sense to program it in a higher level language like Perl or Python, wherein you can get your job done as soon as possible.</p>
<p>However, C still jumps to rescue in situations where speed is critical, and developers want more control over what happens. Python&#8217;s primary implementation is called CPython, because it&#8217;s written in C. It&#8217;s necessary to make sure that the Python interpreter runs your scripts as efficiently as possible.</p>
<h2>Embedded systems and other DIY stuff</h2>
<p>If you&#8217;re a big engineering geek and would like to create your own robots, then you&#8217;d find yourself programming those microcontrollers in C. In such cases, having a command over the C language is quite essential.</p>
<p>If you&#8217;re studying electronics engineering, your projects would definitely need a microcontroller and a knowledge of how to program it.</p>
<h2>It&#8217;s low level stuff</h2>
<p>While higher level languages advertise that you don&#8217;t have to mess with pointers and other dirty stuff, it&#8217;s fun fiddling with pointers in C.</p>
<p>It gives you an understanding of how the system works internally. It also allows you to optimize the working of an algorithm by carefully crafting each step taken.</p>
<p>So, when you want more of speed, control and compactness, you can give C a shot.</p>
<h2>How do you learn C?</h2>
<p>There are a lot of free resources out there for learning C. A quick Google search and you can find them easily.</p>
<p>However, I recently purchased what&#8217;s known as the K&#038;R book for C. The book&#8217;s called <a href="http://www.amazon.com/gp/product/0131103628/ref=as_li_ss_tl?ie=UTF8&#038;tag=revolves-20&#038;linkCode=as2&#038;camp=217153&#038;creative=399349&#038;creativeASIN=0131103628" target="_blank" rel="nofollow">C Programming Language (2nd Edition)</a>.</p>
<p>It&#8217;s written by the people who created C. And it&#8217;s not a huge book either. Although quite expensive for it&#8217;s &#8220;size&#8221;, a number of people at Amazon have reviewed that it&#8217;s well worth it.</p>
<p>If you&#8217;re ever planning on learning C, then this book should more than suffice. I&#8217;ve started going through it and I like the fact that everything&#8217;s concisely organized, and the resource is &#8220;complete&#8221; too. It&#8217;s not as if I&#8217;m looking at a random tutorial that only covers a part of the C language.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.revolves.net/learning-c-programming-why-and-how/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taking User Input Containing Spaces</title>
		<link>http://www.revolves.net/taking-user-input-containing-spaces/</link>
		<comments>http://www.revolves.net/taking-user-input-containing-spaces/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 11:21:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.revolves.net/?p=6</guid>
		<description><![CDATA[In c++, many a times, you&#8217;d want to take a string as an input. But the default cin statement cannot accept spaces, i.e. it terminates the input when it encounters a space. For eg, if you input &#8216;Hello World&#8217;, only &#8216;Hello&#8217; would be stored and rest all discarded. To overcome this, we have a function [...]]]></description>
			<content:encoded><![CDATA[<p>In c++, many a times, you&#8217;d want to take a string as an input. But the default cin statement cannot accept spaces, i.e. it terminates the input when it encounters a space. For eg, if you input &#8216;Hello World&#8217;, only &#8216;Hello&#8217; would be stored and rest all discarded. To overcome this, we have a function called cin.getline().<br />
<span id="more-6"></span></p>
<pre class="brush: cpp; title: ; notranslate">#include &lt;iostream&gt;

using namespace std;

int main()
{
    char stn[20];
    cin.getline(stn,20);
    cout&lt;&lt;stn;
    system(&quot;PAUSE&quot;);
    return 0;
}</pre>
<p>The cin.getline() function accepts two parameters, one is the variable where the input would be stored, and second is the maximum input length.</p>
<p>Lets dissect the above code,</p>
<ul>
<li>First, we declare a variable stn to store a string of maximum length 20.</li>
<li>We use the cin.getline() function, with the first parameter as our declared variable stn and second parameter as the maximum length that stn can hold, i.e 20.</li>
<li>Remember, for example if you specify the length as 5, only a maximum of 4 characters would be taken as input from the user, even if he exceeds this limit. This is because the 5th place is used to store the null terminator.</li>
</ul>
<p>Thus, the function is quite similar to the standard cin function, only that it even allows for spaces.</p>
<p>Have any suggestions or anything to say? Write a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.revolves.net/taking-user-input-containing-spaces/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic
Database Caching 15/29 queries in 0.018 seconds using disk: basic

Served from: www.revolves.net @ 2012-02-04 14:21:19 -->
