<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 1.4 &#8212; A first look at functions</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/</link>
	<description></description>
	<pubDate>Thu, 24 Jul 2008 16:19:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-20674</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 11 Jul 2008 01:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-20674</guid>
		<description>You actually can have two functions in C++ that call each other.  However, to do this, you have to use function prototypes, which we I haven't covered at this point in the tutorials.  I cover this in lesson 1.7.</description>
		<content:encoded><![CDATA[<p>You actually can have two functions in C++ that call each other.  However, to do this, you have to use function prototypes, which we I haven&#8217;t covered at this point in the tutorials.  I cover this in lesson 1.7.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joyel</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-19948</link>
		<dc:creator>Joyel</dc:creator>
		<pubDate>Sat, 28 Jun 2008 04:57:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-19948</guid>
		<description>I come from a pretty decent background.  I have had 7 years experience in my overall field.  I know PHP/Javascript like the back of my hand...I wanted to get into C++ lately and I am working towards it.  So far I love the language.  The ONE thing I don't like so far about it is having to put the main function at the bottom (or the other way you mentioned).  It seems kind of unnecessary and definitely doesn't sound like it'll be very neat and manageable. The hard part is remebring to make a function before that...the one problem I would have is if I had 2 functions that called each other.
In PHP you can have 1 function and then another function and because they are related sometimes each one of the functions ends up calling the OTHER function once.  So that leaves you with something you can't do in C++.  You can't make both functions above each other (impossible) so it won't work like that.</description>
		<content:encoded><![CDATA[<p>I come from a pretty decent background.  I have had 7 years experience in my overall field.  I know PHP/Javascript like the back of my hand&#8230;I wanted to get into C++ lately and I am working towards it.  So far I love the language.  The ONE thing I don&#8217;t like so far about it is having to put the main function at the bottom (or the other way you mentioned).  It seems kind of unnecessary and definitely doesn&#8217;t sound like it&#8217;ll be very neat and manageable. The hard part is remebring to make a function before that&#8230;the one problem I would have is if I had 2 functions that called each other.<br />
In PHP you can have 1 function and then another function and because they are related sometimes each one of the functions ends up calling the OTHER function once.  So that leaves you with something you can&#8217;t do in C++.  You can&#8217;t make both functions above each other (impossible) so it won&#8217;t work like that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitul</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-19166</link>
		<dc:creator>Mitul</dc:creator>
		<pubDate>Tue, 17 Jun 2008 04:18:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-19166</guid>
		<description>/* Program to get double value of Number*/

#include &#60;iostream.h&#62;
#include &#60;conio.h&#62;

int doubleNumber(int x)
{
	return x * 2;
}

void main()
{
	int x;
	clrscr();
	cout &#60;&#60; &#34;n Enter the number : &#34;;
	cin &#62;&#62; x;
	cout &#60;&#60; &#34;n The double value is : &#34;&#60;&#60;doubleNumber(x);
	getch();
}</description>
		<content:encoded><![CDATA[<p>/* Program to get double value of Number*/</p>
<p>#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;</p>
<p>int doubleNumber(int x)<br />
{<br />
	return x * 2;<br />
}</p>
<p>void main()<br />
{<br />
	int x;<br />
	clrscr();<br />
	cout &lt;&lt; &quot;n Enter the number : &quot;;<br />
	cin &gt;&gt; x;<br />
	cout &lt;&lt; &quot;n The double value is : &quot;&lt;&lt;doubleNumber(x);<br />
	getch();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 1.3 &#8212; A first look at variables (and cin)</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-12622</link>
		<dc:creator>Learn C++ - &#187; 1.3 &#8212; A first look at variables (and cin)</dc:creator>
		<pubDate>Wed, 23 Apr 2008 02:20:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-12622</guid>
		<description>[...] andrew: [ I answered your question in my forum. -Alex ] [...]</description>
		<content:encoded><![CDATA[<p>[...] andrew: [ I answered your question in my forum. -Alex ] [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 1.5 &#8212; A first look at operators</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-12586</link>
		<dc:creator>Learn C++ - &#187; 1.5 &#8212; A first look at operators</dc:creator>
		<pubDate>Wed, 23 Apr 2008 01:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-12586</guid>
		<description>[...] andrew: [ I answered your question in my forum. -Alex ] [...]</description>
		<content:encoded><![CDATA[<p>[...] andrew: [ I answered your question in my forum. -Alex ] [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andrew</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-12368</link>
		<dc:creator>andrew</dc:creator>
		<pubDate>Mon, 21 Apr 2008 10:14:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-12368</guid>
		<description>[ I answered your question in my &lt;a href="http://www.dev-spot.com/forums/index.php?topic=94.msg485#msg485" rel="nofollow"&gt;forum&lt;/a&gt;. -Alex ]</description>
		<content:encoded><![CDATA[<p>[ I answered your question in my <a href="http://www.dev-spot.com/forums/index.php?topic=94.msg485#msg485" rel="nofollow">forum</a>. -Alex ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-11949</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 17 Apr 2008 05:25:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-11949</guid>
		<description>There is no difference.  They are functionally equivalent.</description>
		<content:encoded><![CDATA[<p>There is no difference.  They are functionally equivalent.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sony</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-11909</link>
		<dc:creator>sony</dc:creator>
		<pubDate>Wed, 16 Apr 2008 16:27:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-11909</guid>
		<description>what is the difference between the following declarations
void show()and void show(void)</description>
		<content:encoded><![CDATA[<p>what is the difference between the following declarations<br />
void show()and void show(void)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-9500</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 12 Mar 2008 21:17:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-9500</guid>
		<description>Try:

&lt;pre&gt;
int main()
{
	int x;
	cin &gt;&gt; x;
	x = doubleNumber(x);
	cout &lt;&lt; x &lt;&lt; endl;
	cin.clear();
	cin.ignore(255, '\n');
	cin.get();
	return 0;
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Try:</p>
<pre>
int main()
{
	int x;
	cin >> x;
	x = doubleNumber(x);
	cout < < x << endl;
	cin.clear();
	cin.ignore(255, '\n');
	cin.get();
	return 0;
}
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Masss</title>
		<link>http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/#comment-9495</link>
		<dc:creator>Masss</dc:creator>
		<pubDate>Wed, 12 Mar 2008 19:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=23#comment-9495</guid>
		<description>Hi Alex,

I was just doing question 5 of the quiz like everyone else, but the problem is that when I input a number the window closes once immediately after it displays the answer. I know you have to add the statements like cin.get(); cin.clear(); and cin.ignore(255, '/n');, however, it does doesn't prevent it from happening. Heres my coding.

&lt;pre&gt;
// question5.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include &lt;iostream&gt;

using namespace std;

int doubleNumber(int x)
{
	return 2 * x;
	cin.get();
}

int main()
{
	int x;
	cin &gt;&gt; x;
	x = doubleNumber(x);
	cout &lt;&lt; x &lt;&lt; endl;
	cin.get();
	return 0;
}
&lt;/pre&gt;

I tried adding cin.get, as I have commented. THANKS</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>I was just doing question 5 of the quiz like everyone else, but the problem is that when I input a number the window closes once immediately after it displays the answer. I know you have to add the statements like cin.get(); cin.clear(); and cin.ignore(255, &#8216;/n&#8217;);, however, it does doesn&#8217;t prevent it from happening. Heres my coding.</p>
<pre>
// question5.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;

int doubleNumber(int x)
{
	return 2 * x;
	cin.get();
}

int main()
{
	int x;
	cin >> x;
	x = doubleNumber(x);
	cout < < x << endl;
	cin.get();
	return 0;
}
</pre>
<p>I tried adding cin.get, as I have commented. THANKS</iostream></pre>
]]></content:encoded>
	</item>
</channel>
</rss>
