<?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>Wed, 08 Sep 2010 10:51:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: skywolf96</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-90575</link>
		<dc:creator>skywolf96</dc:creator>
		<pubDate>Thu, 19 Aug 2010 19:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-90575</guid>
		<description>It did not paste right the first time but is this a good way to write the program it takes 4 numbers adds them up and multiples them.
&lt;pre&gt;#include &lt;iostream&gt;
int a;
int b;
int c;
int d;
int main ()
{ using namespace std;

cout &lt;&lt; &quot;Enter your first Number&quot; &lt;&lt; endl;

cin &gt;&gt; a;

cout &lt;&lt; &quot;Enter your second number&quot; &lt;&lt; endl; 

cin &gt;&gt; b;

cout &lt;&lt; &quot;Enter your third number&quot; &lt;&lt; endl;

cin &gt;&gt; c;

cout &lt;&lt; &quot;Enter your fourth number&quot; &lt;&lt; endl;

cin &gt;&gt; d;

cout &lt;&lt; &quot;your numbers added up and Multiplyed by 2 is &quot; &lt;&lt; a+b+c+d*2 &lt;&lt; endl;



}
&lt;!--formatted--&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>It did not paste right the first time but is this a good way to write the program it takes 4 numbers adds them up and multiples them.</p>
<pre>#include &lt;iostream&gt;
int a;
int b;
int c;
int d;
int main ()
{ using namespace std;

cout &lt;&lt; &quot;Enter your first Number&quot; &lt;&lt; endl;

cin &gt;&gt; a;

cout &lt;&lt; &quot;Enter your second number&quot; &lt;&lt; endl; 

cin &gt;&gt; b;

cout &lt;&lt; &quot;Enter your third number&quot; &lt;&lt; endl;

cin &gt;&gt; c;

cout &lt;&lt; &quot;Enter your fourth number&quot; &lt;&lt; endl;

cin &gt;&gt; d;

cout &lt;&lt; &quot;your numbers added up and Multiplyed by 2 is &quot; &lt;&lt; a+b+c+d*2 &lt;&lt; endl;

}
<!--formatted--></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: skywolf96</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-90574</link>
		<dc:creator>skywolf96</dc:creator>
		<pubDate>Thu, 19 Aug 2010 19:19:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-90574</guid>
		<description>Is this code good or should I write it a deferent way.
&lt;pre&gt;#include 
int a;
int b;
int c;
int d;
int main ()
{ using namespace std;

cout &lt;&lt; &quot;Enter your first Number&quot; &lt;&gt; a;

cout &lt;&lt; &quot;Enter your second number&quot; &lt;&gt; b;

cout &lt;&lt; &quot;Enter your third number&quot; &lt;&gt; c;

cout &lt;&lt; &quot;Enter your fourth number&quot; &lt;&gt; d;

cout &lt;&lt; &quot;your numbers added up and Multiplyed by 2 is &quot; &lt;&lt; a+b+c+d*2 &lt;&lt; endl;



}
&lt;pre&gt;</description>
		<content:encoded><![CDATA[<p>Is this code good or should I write it a deferent way.</p>
<pre>#include
int a;
int b;
int c;
int d;
int main ()
{ using namespace std;

cout &lt;&lt; &quot;Enter your first Number&quot; &lt;&gt; a;

cout &lt;&lt; &quot;Enter your second number&quot; &lt;&gt; b;

cout &lt;&lt; &quot;Enter your third number&quot; &lt;&gt; c;

cout &lt;&lt; &quot;Enter your fourth number&quot; &lt;&gt; d;

cout &lt;&lt; &quot;your numbers added up and Multiplyed by 2 is &quot; &lt;&lt; a+b+c+d*2 &lt;&lt; endl;

}
</pre>
<pre></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-87931</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Mon, 05 Jul 2010 23:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-87931</guid>
		<description>This began as an attempt to somewhat duplicate the calculator program in the example, one that would read the value, expression, and second value all at the same time. I failed for so long I decided to just try and make a program that would identify what KIND of expression you entered, not even evaluate it. Just for it to say: &quot;You entered an addition equation. &quot; ... and so on for other types of equations. The problem is that no matter what type of equation I enter, whether it is 5 + 5, 5 - 5, 5 * 5, or 5 / 5 I always get a response telling me that I entered a subtraction equation. Any ideas, anyone?

&lt;pre&gt;
#include &lt;iostream&gt;
using namespace std;

long int remainder;
long int x;
long int y;
long int z;
bool expression; 
   
int main()
{   
    cout &lt;&lt; &quot;Enter an expression to be evaluated: &quot; &lt;&lt; endl;
    cin &gt;&gt; expression;
    
    if(expression == true + true) /* i.e. if any integer other than zero is
    entered, followed by a plus sign, then another integer other than zero */
    {
    cout &lt;&lt; &quot;You entered an addition equation. &quot; &lt;&lt; endl;
    }
    
    if(expression == true/true) /* i.e. if any integer other than zero is
    entered, followed by a division sign, then another integer other than zero */
    {
    cout &lt;&lt; &quot;You entered a division equation. &quot; &lt;&lt; endl;
    }
    
    if(expression == true-true) // like above, but with subtraction
    {
    cout &lt;&lt; &quot;You entered a subtraction equation. &quot; &lt;&lt; endl;
    }
    
    if(expression == true*true) // and again like above, with multiplication
    {
    cout &lt;&lt; &quot;You entered a multiplication equation. &quot; &lt;&lt; endl;
    }    
                                       
    cin.clear();
    cin.ignore(255, &#039;\n&#039;);
    cin.get();
    // ^^ is for Dev C++ so the program stays open until I prompt it to exit                
    return 0;                  

}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>This began as an attempt to somewhat duplicate the calculator program in the example, one that would read the value, expression, and second value all at the same time. I failed for so long I decided to just try and make a program that would identify what KIND of expression you entered, not even evaluate it. Just for it to say: &#8220;You entered an addition equation. &#8221; &#8230; and so on for other types of equations. The problem is that no matter what type of equation I enter, whether it is 5 + 5, 5 &#8211; 5, 5 * 5, or 5 / 5 I always get a response telling me that I entered a subtraction equation. Any ideas, anyone?</p>
<pre>
#include &lt;iostream&gt;
using namespace std;

long int remainder;
long int x;
long int y;
long int z;
bool expression; 

int main()
{
    cout &lt;&lt; &quot;Enter an expression to be evaluated: &quot; &lt;&lt; endl;
    cin &gt;&gt; expression;

    if(expression == true + true) /* i.e. if any integer other than zero is
    entered, followed by a plus sign, then another integer other than zero */
    {
    cout &lt;&lt; &quot;You entered an addition equation. &quot; &lt;&lt; endl;
    }

    if(expression == true/true) /* i.e. if any integer other than zero is
    entered, followed by a division sign, then another integer other than zero */
    {
    cout &lt;&lt; &quot;You entered a division equation. &quot; &lt;&lt; endl;
    }

    if(expression == true-true) // like above, but with subtraction
    {
    cout &lt;&lt; &quot;You entered a subtraction equation. &quot; &lt;&lt; endl;
    }

    if(expression == true*true) // and again like above, with multiplication
    {
    cout &lt;&lt; &quot;You entered a multiplication equation. &quot; &lt;&lt; endl;
    }    

    cin.clear();
    cin.ignore(255, &#39;\n&#39;);
    cin.get();
    // ^^ is for Dev C++ so the program stays open until I prompt it to exit
    return 0;                  

}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: armian</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-85709</link>
		<dc:creator>armian</dc:creator>
		<pubDate>Mon, 31 May 2010 21:33:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-85709</guid>
		<description>Thank you a lot for this magical tutorial!!!

I have a question:&quot;How can I compile my program if I haven&#039;t finished it yet?&quot;
When i compile to see if i have any error till here,my Bloodshed Dev-C++ &quot;says&quot; that i have too many mistakes!

Thanks a lot again!</description>
		<content:encoded><![CDATA[<p>Thank you a lot for this magical tutorial!!!</p>
<p>I have a question:&#8221;How can I compile my program if I haven&#8217;t finished it yet?&#8221;<br />
When i compile to see if i have any error till here,my Bloodshed Dev-C++ &#8220;says&#8221; that i have too many mistakes!</p>
<p>Thanks a lot again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gio</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-83876</link>
		<dc:creator>Gio</dc:creator>
		<pubDate>Sat, 01 May 2010 01:03:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-83876</guid>
		<description>Whoops! Sorry, I skipped cin by mistake!</description>
		<content:encoded><![CDATA[<p>Whoops! Sorry, I skipped cin by mistake!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gio</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-83806</link>
		<dc:creator>Gio</dc:creator>
		<pubDate>Thu, 29 Apr 2010 22:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-83806</guid>
		<description>I did not understand one thing in this lesson, but you may have not been mentioning it or be mentioning it later: How do you get keyboard input? So, like, the person can enter their name, press enter, and then the program will print it? If you will explain this later, I am sorry for being impatient.</description>
		<content:encoded><![CDATA[<p>I did not understand one thing in this lesson, but you may have not been mentioning it or be mentioning it later: How do you get keyboard input? So, like, the person can enter their name, press enter, and then the program will print it? If you will explain this later, I am sorry for being impatient.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-82767</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Mon, 12 Apr 2010 14:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-82767</guid>
		<description>Hello, I am fairly new to programming and have been finding these tutorials very helpful. Could someone please help me find out what is wrong with my code. Everything compiles fine, but when I run the program the result is for example if I wanted to calculate 1+2 the answer would print 2. The second number always gets printed and not the calculated value.

&lt;pre&gt;
#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

int GetUserInput();
char GetMathematicalOperation();
int CalculateResult(int nInput1, char chOperator, int nInput2);
void PrintResult(int x);
using namespace std;

int main()
{
    // Get first number from user
    int nInput1 = GetUserInput();

    // Get mathematical operation from user
    char chOperator = GetMathematicalOperation();

    // Get second number from user
    int nInput2 = GetUserInput();

    // Calculate result and store into variable nResult    
    int nResult = CalculateResult(nInput1, chOperator, nInput2);
    
    // Print result	
    PrintResult(nResult);

    return 0;
}

int GetUserInput()
{
	int input;
	cin &gt;&gt; input;
	return input;
}

char GetMathematicalOperation()
{
	char chOperation;
	cin &gt;&gt; chOperation;
	return chOperation;
}

void PrintResult(int x)
{
	cout &lt;&lt; x &lt;&lt; endl;
}

int CalculateResult(int nInput1, char chOperator, int nInput2)
{
	int x = (nInput1, chOperator, nInput2);
	return x;
}
&lt;!--formatted--&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hello, I am fairly new to programming and have been finding these tutorials very helpful. Could someone please help me find out what is wrong with my code. Everything compiles fine, but when I run the program the result is for example if I wanted to calculate 1+2 the answer would print 2. The second number always gets printed and not the calculated value.</p>
<pre>
#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

int GetUserInput();
char GetMathematicalOperation();
int CalculateResult(int nInput1, char chOperator, int nInput2);
void PrintResult(int x);
using namespace std;

int main()
{
    // Get first number from user
    int nInput1 = GetUserInput();

    // Get mathematical operation from user
    char chOperator = GetMathematicalOperation();

    // Get second number from user
    int nInput2 = GetUserInput();

    // Calculate result and store into variable nResult
    int nResult = CalculateResult(nInput1, chOperator, nInput2);

    // Print result
    PrintResult(nResult);

    return 0;
}

int GetUserInput()
{
	int input;
	cin &gt;&gt; input;
	return input;
}

char GetMathematicalOperation()
{
	char chOperation;
	cin &gt;&gt; chOperation;
	return chOperation;
}

void PrintResult(int x)
{
	cout &lt;&lt; x &lt;&lt; endl;
}

int CalculateResult(int nInput1, char chOperator, int nInput2)
{
	int x = (nInput1, chOperator, nInput2);
	return x;
}
<!--formatted--></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: User1</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-82527</link>
		<dc:creator>User1</dc:creator>
		<pubDate>Fri, 09 Apr 2010 03:24:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-82527</guid>
		<description>I recently decided to teach myself C++ because I would like to get into game programming and well I am glad I found this wonderful tutorial. I understand it will take time and am willing to do give time, but I&#039;m curious if I will be able to make a 2D World (as stated in this article) soon seeing as I am on Chapter 2 at the moment and am a bit confused how to put graphics to program.</description>
		<content:encoded><![CDATA[<p>I recently decided to teach myself C++ because I would like to get into game programming and well I am glad I found this wonderful tutorial. I understand it will take time and am willing to do give time, but I&#8217;m curious if I will be able to make a 2D World (as stated in this article) soon seeing as I am on Chapter 2 at the moment and am a bit confused how to put graphics to program.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: replax</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-79900</link>
		<dc:creator>replax</dc:creator>
		<pubDate>Sat, 06 Mar 2010 19:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-79900</guid>
		<description>you missed the function prototypes at the beginngin and you need to put the last functions inside of int main(). it&#039;s best for you to read on, your problems will be addressed very soon in alex&#039;s superb tutorials!</description>
		<content:encoded><![CDATA[<p>you missed the function prototypes at the beginngin and you need to put the last functions inside of int main(). it&#8217;s best for you to read on, your problems will be addressed very soon in alex&#8217;s superb tutorials!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rami</title>
		<link>http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/comment-page-1/#comment-78119</link>
		<dc:creator>rami</dc:creator>
		<pubDate>Wed, 10 Feb 2010 04:31:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=262#comment-78119</guid>
		<description>hi i have a problem with my code
&lt;pre&gt;#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main()
{     
       int GetNumber();

       char GetOperation();

       int GetNumber2();

       int CalResult();

       int PrintResult();
       return 0;
}

int GetNumber()
{  
    int x;
    cin &gt;&gt; x;
    return x;
}

char GetOperation()
{
     char chOperation;
     cin &gt;&gt; chOperation;
     return chOperation;
}

int GetNumber2()
{
    int y;
    cin &gt;&gt; y;
    return y;
}


int CalResult(int x, char chOperation, int y);

int PrintResult( CalResult(int x char chOperation int y) );

PrintResult(Presult);
&lt;/pre&gt;
here is the following erros
44 C:\Users\nabeel\main.cpp expected primary-expression before &quot;int&quot; 
46 C:\Users\nabeel\main.cpp expected constructor, destructor, or type conversion before &#039;(&#039; token 
46 C:\Users\nabeel\main.cpp expected `,&#039; or `;&#039; before &#039;(&#039; token 
 C:\Users\nabeel\Makefile.win [Build Error]  [main.o] Error 1</description>
		<content:encoded><![CDATA[<p>hi i have a problem with my code</p>
<pre>#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main()
{
       int GetNumber();

       char GetOperation();

       int GetNumber2();

       int CalResult();

       int PrintResult();
       return 0;
}

int GetNumber()
{
    int x;
    cin &gt;&gt; x;
    return x;
}

char GetOperation()
{
     char chOperation;
     cin &gt;&gt; chOperation;
     return chOperation;
}

int GetNumber2()
{
    int y;
    cin &gt;&gt; y;
    return y;
}

int CalResult(int x, char chOperation, int y);

int PrintResult( CalResult(int x char chOperation int y) );

PrintResult(Presult);
</pre>
<p>here is the following erros<br />
44 C:\Users\nabeel\main.cpp expected primary-expression before &#8220;int&#8221;<br />
46 C:\Users\nabeel\main.cpp expected constructor, destructor, or type conversion before &#8216;(&#8216; token<br />
46 C:\Users\nabeel\main.cpp expected `,&#8217; or `;&#8217; before &#8216;(&#8216; token<br />
 C:\Users\nabeel\Makefile.win [Build Error]  [main.o] Error 1</p>
]]></content:encoded>
	</item>
</channel>
</rss>
