<?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.10a &#8212; How to design your first programs</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/</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: Andrew_Hicks</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-96789</link>
		<dc:creator>Andrew_Hicks</dc:creator>
		<pubDate>Wed, 04 Jan 2012 21:32:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-96789</guid>
		<description>What is the reason for adding 

#include 

i deleted it for the calculator that you made and it still worked, i was wondering if it was just added to be sure or if i&#039;m missing something?</description>
		<content:encoded><![CDATA[<p>What is the reason for adding </p>
<p>#include </p>
<p>i deleted it for the calculator that you made and it still worked, i was wondering if it was just added to be sure or if i&#8217;m missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ascendancy</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-96752</link>
		<dc:creator>Ascendancy</dc:creator>
		<pubDate>Wed, 28 Dec 2011 12:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-96752</guid>
		<description>Silly me, I posted the comment in the wrong section. It was meant to be posted in section 1.11.</description>
		<content:encoded><![CDATA[<p>Silly me, I posted the comment in the wrong section. It was meant to be posted in section 1.11.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ascendancy</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-96751</link>
		<dc:creator>Ascendancy</dc:creator>
		<pubDate>Wed, 28 Dec 2011 12:10:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-96751</guid>
		<description>Haha, I ended up with an answer almost identical to Alex&#039;s. I used a header file for the first question; who cares if I didn&#039;t read every question thoroughly, I used the best method for the job.</description>
		<content:encoded><![CDATA[<p>Haha, I ended up with an answer almost identical to Alex&#8217;s. I used a header file for the first question; who cares if I didn&#8217;t read every question thoroughly, I used the best method for the job.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-96038</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Mon, 19 Sep 2011 16:29:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-96038</guid>
		<description>You need to use two equality signs (&quot;=&quot;) when comparing something.
A single sign is an assignment.</description>
		<content:encoded><![CDATA[<p>You need to use two equality signs (&#8220;=&#8221;) when comparing something.<br />
A single sign is an assignment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hex</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-96035</link>
		<dc:creator>Hex</dc:creator>
		<pubDate>Sat, 17 Sep 2011 17:00:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-96035</guid>
		<description>int Calculate(int, char, int)
{
if (Operation = ‘+’)
return Number1+Number2;

if (Operation = ‘-’)
return Number1-Number2;

if (Operation = ‘*’)
return Number1*Number2;

if (Operation = ‘/’)
return Number1/Number2;

return (0);
}
my code wont do any thing but add. What have i done wrong.</description>
		<content:encoded><![CDATA[<p>int Calculate(int, char, int)<br />
{<br />
if (Operation = ‘+’)<br />
return Number1+Number2;</p>
<p>if (Operation = ‘-’)<br />
return Number1-Number2;</p>
<p>if (Operation = ‘*’)<br />
return Number1*Number2;</p>
<p>if (Operation = ‘/’)<br />
return Number1/Number2;</p>
<p>return (0);<br />
}<br />
my code wont do any thing but add. What have i done wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maksism</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-95905</link>
		<dc:creator>Maksism</dc:creator>
		<pubDate>Sun, 21 Aug 2011 06:40:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-95905</guid>
		<description>&lt;pre&gt;#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

using namespace std;

int GetNumber1()
{
	cout &lt;&lt; &quot;Please type in number &quot;;
	int nX;
	cin &gt;&gt; nX;
	return nX;
	}

char GetMathOperation()
{
	cout &lt;&lt; &quot;Please enter + - * /&quot;; 
	char cOp;
	cin &gt;&gt; cOp;
	return cOp;
}

int GetNumber2()
{
	cout &lt;&lt; &quot;Please type in number &quot;;
	int nY;
	cin &gt;&gt; nY;
	return nY;
}

int CalResults(int nX, char cOp, int nY)
{
	if (cOp==&#039;+&#039;)
		return nX + nY;
	if (cOp==&#039;-&#039;)
		return nX - nY;
	if (cOp==&#039;*&#039;)
		return nX * nY;
	if (cOp==&#039;/&#039;)
		return nX / nY;

	return 0;
}

void PrintResults(int nResult)
{
	cout &lt;&lt; &quot;The answer is &quot; &lt;&lt; nResult &lt;&lt; endl;
}
int main()
{
	int nX = GetNumber1();
	char cOp = GetMathOperation();
	int nY = GetNumber2();
	int nResult = CalResults(nX, cOp, nY);
	PrintResults(nResult);
	cin.clear();
	cin.ignore(255, &#039;\n&#039;);
	cin.get();
}&lt;/pre&gt;

Finally got it</description>
		<content:encoded><![CDATA[<pre>#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

using namespace std;

int GetNumber1()
{
	cout &lt;&lt; &quot;Please type in number &quot;;
	int nX;
	cin &gt;&gt; nX;
	return nX;
	}

char GetMathOperation()
{
	cout &lt;&lt; &quot;Please enter + - * /&quot;;
	char cOp;
	cin &gt;&gt; cOp;
	return cOp;
}

int GetNumber2()
{
	cout &lt;&lt; &quot;Please type in number &quot;;
	int nY;
	cin &gt;&gt; nY;
	return nY;
}

int CalResults(int nX, char cOp, int nY)
{
	if (cOp==&#039;+&#039;)
		return nX + nY;
	if (cOp==&#039;-&#039;)
		return nX - nY;
	if (cOp==&#039;*&#039;)
		return nX * nY;
	if (cOp==&#039;/&#039;)
		return nX / nY;

	return 0;
}

void PrintResults(int nResult)
{
	cout &lt;&lt; &quot;The answer is &quot; &lt;&lt; nResult &lt;&lt; endl;
}
int main()
{
	int nX = GetNumber1();
	char cOp = GetMathOperation();
	int nY = GetNumber2();
	int nResult = CalResults(nX, cOp, nY);
	PrintResults(nResult);
	cin.clear();
	cin.ignore(255, &#039;\n&#039;);
	cin.get();
}</pre>
<p>Finally got it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-95895</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Sat, 20 Aug 2011 15:36:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-95895</guid>
		<description>@Chris - Gravatar. 
@Kostas81 - when you call on the writenumber, it copies the value of whatever you send to the function, defines it as &#039;c&#039;, uses it, and at the end of the function it destroys the value, if that was what you were asking.</description>
		<content:encoded><![CDATA[<p>@Chris &#8211; Gravatar.<br />
@Kostas81 &#8211; when you call on the writenumber, it copies the value of whatever you send to the function, defines it as &#8216;c&#8217;, uses it, and at the end of the function it destroys the value, if that was what you were asking.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-95799</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 25 Jul 2011 20:50:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-95799</guid>
		<description>Hey, how did you set your avatar? I dont see any option for that in my profile settings.</description>
		<content:encoded><![CDATA[<p>Hey, how did you set your avatar? I dont see any option for that in my profile settings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-95798</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 25 Jul 2011 20:50:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-95798</guid>
		<description>Yeah, i need to go through these tutorials again. Im going through them fast, too much information lol.</description>
		<content:encoded><![CDATA[<p>Yeah, i need to go through these tutorials again. Im going through them fast, too much information lol.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kostas81</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-95797</link>
		<dc:creator>Kostas81</dc:creator>
		<pubDate>Mon, 25 Jul 2011 16:37:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-95797</guid>
		<description>I think you are right. The variables nX and nY are defined and used localy inside 
int CalculateResult(int nX, char chOperation, int nY). But it is the caller, that is, main(), which decides which the variables are, and the decision is nX = nInput1 and nY = nInput2. (It could be just a number, as for example nX = 3 and nY = 5, as in a previous example. But here the number is the integer given from the user as input. The first number is assigned to nInput1 and the second to nInput2. And then, main() uses int CalculateResult(nInput1, chOperation, nInput2).

This is the simplest way I can explain what I think ...

Thank you for your reply!</description>
		<content:encoded><![CDATA[<p>I think you are right. The variables nX and nY are defined and used localy inside<br />
int CalculateResult(int nX, char chOperation, int nY). But it is the caller, that is, main(), which decides which the variables are, and the decision is nX = nInput1 and nY = nInput2. (It could be just a number, as for example nX = 3 and nY = 5, as in a previous example. But here the number is the integer given from the user as input. The first number is assigned to nInput1 and the second to nInput2. And then, main() uses int CalculateResult(nInput1, chOperation, nInput2).</p>
<p>This is the simplest way I can explain what I think &#8230;</p>
<p>Thank you for your reply!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

