<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 1.11 &#8212; Comprehensive quiz</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 12:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: xero</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96388</link>
		<dc:creator>xero</dc:creator>
		<pubDate>Tue, 15 Nov 2011 18:33:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96388</guid>
		<description>i believe the problem lies at void WriteAnswer()
as far as my understanding goes you need to declare a variable, which can hold return value from ReadNumbers() function.
segment of my code was as follows:
void WriteAnswer()
int z = ReadNumbers()
cout &lt;&lt; &quot;Sum of both numbers is &quot; &lt;&lt; z &lt;&lt; endl;
and my main was just like yours.
Someone please correct me if i am wrong.</description>
		<content:encoded><![CDATA[<p>i believe the problem lies at void WriteAnswer()<br />
as far as my understanding goes you need to declare a variable, which can hold return value from ReadNumbers() function.<br />
segment of my code was as follows:<br />
void WriteAnswer()<br />
int z = ReadNumbers()<br />
cout &lt;&lt; &quot;Sum of both numbers is &quot; &lt;&lt; z &lt;&lt; endl;<br />
and my main was just like yours.<br />
Someone please correct me if i am wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xero</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96387</link>
		<dc:creator>xero</dc:creator>
		<pubDate>Tue, 15 Nov 2011 10:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96387</guid>
		<description>Another thing, you said in some section that using cout in some function with void return type would create a compiler error, however we see void WriteAnswer() working fine, how?</description>
		<content:encoded><![CDATA[<p>Another thing, you said in some section that using cout in some function with void return type would create a compiler error, however we see void WriteAnswer() working fine, how?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xero</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96385</link>
		<dc:creator>xero</dc:creator>
		<pubDate>Tue, 15 Nov 2011 09:54:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96385</guid>
		<description>First of all I would like to thank you a lot for providing such a holistic and easy to understand material on C++. Its really fun learning with you. Thank you again.
After having gone through Quiz 1, I have following queries:
1. int WriteAnswer() can be used instead of void WriteAnswer(), code works perfectly alright with this. Whats really the difference between both.
2. Will there be detailed section on different/preferential ways on piping input/output results between/among function?
3. Following is my code on Q1 Quiz 1 (I was only able to get my code running only after going through the solution). I would appreciate few comments.

#include  //Quiz 1 my solution after consulting answer from learncpp(dot)com

int ReadNumber()
{
    using namespace std;
    int x;
    int y;
    cout &lt;&gt; x;
    cout &lt;&gt; y;
    return x+y;
}

void WriteAnswer()
{
    using namespace std;
    int z = ReadNumber();
    cout &lt;&lt; &quot;Sum of Both Numbers is &quot; &lt;&lt; z &lt;&lt; endl;
}

int main()
{
    WriteAnswer();
    return 0;
}</description>
		<content:encoded><![CDATA[<p>First of all I would like to thank you a lot for providing such a holistic and easy to understand material on C++. Its really fun learning with you. Thank you again.<br />
After having gone through Quiz 1, I have following queries:<br />
1. int WriteAnswer() can be used instead of void WriteAnswer(), code works perfectly alright with this. Whats really the difference between both.<br />
2. Will there be detailed section on different/preferential ways on piping input/output results between/among function?<br />
3. Following is my code on Q1 Quiz 1 (I was only able to get my code running only after going through the solution). I would appreciate few comments.</p>
<p>#include  //Quiz 1 my solution after consulting answer from learncpp(dot)com</p>
<p>int ReadNumber()<br />
{<br />
    using namespace std;<br />
    int x;<br />
    int y;<br />
    cout &lt;&gt; x;<br />
    cout &lt;&gt; y;<br />
    return x+y;<br />
}</p>
<p>void WriteAnswer()<br />
{<br />
    using namespace std;<br />
    int z = ReadNumber();<br />
    cout &lt;&lt; &quot;Sum of Both Numbers is &quot; &lt;&lt; z &lt;&lt; endl;<br />
}</p>
<p>int main()<br />
{<br />
    WriteAnswer();<br />
    return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lelouche_z</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96326</link>
		<dc:creator>lelouche_z</dc:creator>
		<pubDate>Mon, 07 Nov 2011 15:15:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96326</guid>
		<description>haha.. grabeh wla akong idea panu ko siya gagawin..
XD

more practice needed.. :D</description>
		<content:encoded><![CDATA[<p>haha.. grabeh wla akong idea panu ko siya gagawin..<br />
XD</p>
<p>more practice needed.. :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trophy</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-1/#comment-96268</link>
		<dc:creator>Trophy</dc:creator>
		<pubDate>Wed, 02 Nov 2011 06:12:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96268</guid>
		<description>I&#039;m sorry to reply to your comment even though this has nothing to do with it, but I can&#039;t figure out how to comment without replying. Anyway, there&#039;s a problem with your code. Basically you&#039;re telling the compiler to go to main.cpp to io.h and then to io.cpp, but that isn&#039;t how the compiler reads it, the compiler reads it as main.cpp to io.h to main.cpp which causes the compiler to stop before &quot;ReadNumber()&quot; and &quot;WriteAnswer()&quot; are defined, even though they&#039;ve been declared. I kept getting &quot;undefined reference&quot; error, because of the way the program was set up, so I put &#039;#include &quot;io.cpp&quot;&#039; in the header file and it worked again, which revealed the problem. Am I wrong, or is my compiler just not set up correctly?</description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry to reply to your comment even though this has nothing to do with it, but I can&#8217;t figure out how to comment without replying. Anyway, there&#8217;s a problem with your code. Basically you&#8217;re telling the compiler to go to main.cpp to io.h and then to io.cpp, but that isn&#8217;t how the compiler reads it, the compiler reads it as main.cpp to io.h to main.cpp which causes the compiler to stop before &#8220;ReadNumber()&#8221; and &#8220;WriteAnswer()&#8221; are defined, even though they&#8217;ve been declared. I kept getting &#8220;undefined reference&#8221; error, because of the way the program was set up, so I put &#8216;#include &#8220;io.cpp&#8221;&#8216; in the header file and it worked again, which revealed the problem. Am I wrong, or is my compiler just not set up correctly?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vastor</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96127</link>
		<dc:creator>Vastor</dc:creator>
		<pubDate>Mon, 10 Oct 2011 01:58:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96127</guid>
		<description>And... this is my trial... :D

File : main.cpp

#include 
#include &quot;nUser_input.h&quot;
#include &quot;nSum.h&quot;

using namespace std;

int main()
{
    int nResult;
    int y;
    nResult = WriteAnswer(y);
    cout &lt;&lt; &quot;Sums of the two number: &quot; &lt;&lt; nResult &lt;&lt; endl;
    return 0;
}



File : nSum.h

#ifndef NSUM_H_INCLUDED
#define NSUM_H_INCLUDED

int WriteAnswer(int x)
{
    int nInput_1 = Read_Number();
    int nInput_2 = Read_Number();
    return nInput_1 + nInput_2;
}

#endif // NSUM_H_INCLUDED



File : nUser_input.h

#ifndef NUSER_INPUT_H_INCLUDED
#define NUSER_INPUT_H_INCLUDED

#include 

using namespace std;

int Read_Number()
{
    cout &lt;&gt; nInput;
    return nInput;
}

#endif // NUSER_INPUT_H_INCLUDED



really wonder what to do when the instruction tell can&#039;t use function to sum up the number input, so i just use return x + y &#039;trick&#039;.... xD</description>
		<content:encoded><![CDATA[<p>And&#8230; this is my trial&#8230; :D</p>
<p>File : main.cpp</p>
<p>#include<br />
#include &#8220;nUser_input.h&#8221;<br />
#include &#8220;nSum.h&#8221;</p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
    int nResult;<br />
    int y;<br />
    nResult = WriteAnswer(y);<br />
    cout &lt;&lt; &quot;Sums of the two number: &quot; &lt;&lt; nResult &lt;&lt; endl;<br />
    return 0;<br />
}</p>
<p>File : nSum.h</p>
<p>#ifndef NSUM_H_INCLUDED<br />
#define NSUM_H_INCLUDED</p>
<p>int WriteAnswer(int x)<br />
{<br />
    int nInput_1 = Read_Number();<br />
    int nInput_2 = Read_Number();<br />
    return nInput_1 + nInput_2;<br />
}</p>
<p>#endif // NSUM_H_INCLUDED</p>
<p>File : nUser_input.h</p>
<p>#ifndef NUSER_INPUT_H_INCLUDED<br />
#define NUSER_INPUT_H_INCLUDED</p>
<p>#include </p>
<p>using namespace std;</p>
<p>int Read_Number()<br />
{<br />
    cout &lt;&gt; nInput;<br />
    return nInput;<br />
}</p>
<p>#endif // NUSER_INPUT_H_INCLUDED</p>
<p>really wonder what to do when the instruction tell can&#8217;t use function to sum up the number input, so i just use return x + y &#8216;trick&#8217;&#8230;. xD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96039</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Mon, 19 Sep 2011 16:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96039</guid>
		<description>Operation needs to be a char, not an int.
When comparing things, use two equals sign.</description>
		<content:encoded><![CDATA[<p>Operation needs to be a char, not an int.<br />
When comparing things, use two equals sign.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hex</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96034</link>
		<dc:creator>Hex</dc:creator>
		<pubDate>Sat, 17 Sep 2011 16:46:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96034</guid>
		<description>#include &quot;stdafx.h&quot;
#include 

int Number1;
int Number2;
int Operation;
int Result;


int Getnumbers()
{
	using namespace std;
	cout &lt;&gt; Number1;
	cout &lt;&gt; Number2;
	return (0);
}
int Getoperation()
{
	using namespace std;
	cout &lt;&gt; Operation;
	return (Operation);
}
int Calculate(int, char, int)
{
	if (Operation = &#039;+&#039;)
	return Number1+Number2;

	if (Operation = &#039;-&#039;)
	return Number1-Number2;

	if (Operation = &#039;*&#039;)
	return Number1*Number2;

	if (Operation = &#039;/&#039;)
	return Number1/Number2;

	return (0);
}
void Printresult(int)
{
	using namespace std;
	cout &lt;&lt; &quot;Your Result Is &quot; &lt;&lt; Result &lt;&lt; endl;
}

int main()
{
	Getnumbers();
	Getoperation();
	Result = Calculate(Number1, Operation, Number2);
	Printresult(Result);

}
sorry this is the real code my computer failed</description>
		<content:encoded><![CDATA[<p>#include &#8220;stdafx.h&#8221;<br />
#include </p>
<p>int Number1;<br />
int Number2;<br />
int Operation;<br />
int Result;</p>
<p>int Getnumbers()<br />
{<br />
	using namespace std;<br />
	cout &lt;&gt; Number1;<br />
	cout &lt;&gt; Number2;<br />
	return (0);<br />
}<br />
int Getoperation()<br />
{<br />
	using namespace std;<br />
	cout &lt;&gt; Operation;<br />
	return (Operation);<br />
}<br />
int Calculate(int, char, int)<br />
{<br />
	if (Operation = &#8216;+&#8217;)<br />
	return Number1+Number2;</p>
<p>	if (Operation = &#8216;-&#8217;)<br />
	return Number1-Number2;</p>
<p>	if (Operation = &#8216;*&#8217;)<br />
	return Number1*Number2;</p>
<p>	if (Operation = &#8216;/&#8217;)<br />
	return Number1/Number2;</p>
<p>	return (0);<br />
}<br />
void Printresult(int)<br />
{<br />
	using namespace std;<br />
	cout &lt;&lt; &quot;Your Result Is &quot; &lt;&lt; Result &lt;&lt; endl;<br />
}</p>
<p>int main()<br />
{<br />
	Getnumbers();<br />
	Getoperation();<br />
	Result = Calculate(Number1, Operation, Number2);<br />
	Printresult(Result);</p>
<p>}<br />
sorry this is the real code my computer failed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hex</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96033</link>
		<dc:creator>Hex</dc:creator>
		<pubDate>Sat, 17 Sep 2011 16:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96033</guid>
		<description>#include &quot;stdafx.h&quot;
#include 

int Number1;
int Number2;
int Operation;
int Result;


int Getnumbers()
{
	using namespace std;
	cout &lt;&gt; Number1;
	cout &lt;&gt; Number2;
	return (0);
}
int Getoperation()
{
	using namespace std;
	cout &lt;&gt; Operation;
	return (Operation);
}
int Calculate(int, char, int)
{
	if (Operation = &#039;+&#039;)
	return Number1+Number2;

	if (Operation = &#039;-&#039;)
	return Number1-Number2;

	if (Operation = &#039;*&#039;)
	return Number1*Number2;

	if (Operation = &#039;/&#039;)
	return Number1/Number2;

	return (0);
}
void Printresult(int)
{
	using namespace std;
	cout &lt;&lt; &quot;Your Result Is &quot; &lt;&lt; Result &lt;&lt; endl;
}

int main()
{
	Getnumbers();
	Getoperation();
	Result = Calculate(Number1, Operation, Number2);
	Printresult(Result);

}
 this is my calculator code but it will only add the two numbers instead of any thing else. Help im a N00B.</description>
		<content:encoded><![CDATA[<p>#include &#8220;stdafx.h&#8221;<br />
#include </p>
<p>int Number1;<br />
int Number2;<br />
int Operation;<br />
int Result;</p>
<p>int Getnumbers()<br />
{<br />
	using namespace std;<br />
	cout &lt;&gt; Number1;<br />
	cout &lt;&gt; Number2;<br />
	return (0);<br />
}<br />
int Getoperation()<br />
{<br />
	using namespace std;<br />
	cout &lt;&gt; Operation;<br />
	return (Operation);<br />
}<br />
int Calculate(int, char, int)<br />
{<br />
	if (Operation = &#8216;+&#8217;)<br />
	return Number1+Number2;</p>
<p>	if (Operation = &#8216;-&#8217;)<br />
	return Number1-Number2;</p>
<p>	if (Operation = &#8216;*&#8217;)<br />
	return Number1*Number2;</p>
<p>	if (Operation = &#8216;/&#8217;)<br />
	return Number1/Number2;</p>
<p>	return (0);<br />
}<br />
void Printresult(int)<br />
{<br />
	using namespace std;<br />
	cout &lt;&lt; &quot;Your Result Is &quot; &lt;&lt; Result &lt;&lt; endl;<br />
}</p>
<p>int main()<br />
{<br />
	Getnumbers();<br />
	Getoperation();<br />
	Result = Calculate(Number1, Operation, Number2);<br />
	Printresult(Result);</p>
<p>}<br />
 this is my calculator code but it will only add the two numbers instead of any thing else. Help im a N00B.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: quack</title>
		<link>http://www.learncpp.com/cpp-tutorial/111-comprehensive-quiz/comment-page-2/#comment-96029</link>
		<dc:creator>quack</dc:creator>
		<pubDate>Fri, 16 Sep 2011 04:50:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=34#comment-96029</guid>
		<description>Hey Kamakasy, I think you have a typo. Change &quot;unfdef&quot; to &quot;ifndef&quot;.</description>
		<content:encoded><![CDATA[<p>Hey Kamakasy, I think you have a typo. Change &#8220;unfdef&#8221; to &#8220;ifndef&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

