<?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: 3.2 &#8212; Arithmetic operators</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/</link>
	<description></description>
	<lastBuildDate>Fri, 12 Mar 2010 16:52:45 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Random C++ learner</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-77996</link>
		<dc:creator>Random C++ learner</dc:creator>
		<pubDate>Sun, 07 Feb 2010 00:18:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-77996</guid>
		<description>&lt;pre&gt;
#include &lt;iostream&gt;


int main()
{
    using namespace std;
    cout &lt;&lt; &quot;Make 100 by adding a number to 23: &quot;;
    double dX;
    cin &gt;&gt; dX;

    cout &lt;&lt; &quot;23 + &quot; &lt;&lt; dX &lt;&lt; &quot; Makes &quot; &lt;&lt; 23 + dX &lt;&lt; endl;

    if (dX == 77)

    cout &lt;&lt; &quot;Congratulations you can do basic math.&quot; &lt;&lt; endl;

    else

    cout &lt;&lt; &quot;\aoh dear, i hope you were testing the else statement...&quot; &lt;&lt; endl;

    return 0;
}
&lt;/pre&gt;

if the
&lt;pre&gt; if (dX == 77) &lt;/pre&gt; is not bracketed, then it does not know what to check/ search for, and therefore won&#039;t compile.

Although by now, you probably know why anyway. but a bit of practice in explaining anyway... every little helps.</description>
		<content:encoded><![CDATA[<pre>
#include &lt;iostream&gt;

int main()
{
    using namespace std;
    cout &lt;&lt; &quot;Make 100 by adding a number to 23: &quot;;
    double dX;
    cin &gt;&gt; dX;

    cout &lt;&lt; &quot;23 + &quot; &lt;&lt; dX &lt;&lt; &quot; Makes &quot; &lt;&lt; 23 + dX &lt;&lt; endl;

    if (dX == 77)

    cout &lt;&lt; &quot;Congratulations you can do basic math.&quot; &lt;&lt; endl;

    else

    cout &lt;&lt; &quot;\aoh dear, i hope you were testing the else statement...&quot; &lt;&lt; endl;

    return 0;
}
</pre>
<p>if the</p>
<pre> if (dX == 77) </pre>
<p> is not bracketed, then it does not know what to check/ search for, and therefore won&#8217;t compile.</p>
<p>Although by now, you probably know why anyway. but a bit of practice in explaining anyway&#8230; every little helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BorisTheSpider</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-75817</link>
		<dc:creator>BorisTheSpider</dc:creator>
		<pubDate>Wed, 06 Jan 2010 04:13:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-75817</guid>
		<description>I&#039;m using Code::Blocks, and if I run my program from the last chapter&#039;s quiz and enter 0 as the second number (named dY in the example answer) and choose the division sign (/), it doesn&#039;t crash. Rather, it tells me the answer is &quot;Infinity&quot;.

I&#039;m not sure if that&#039;s compiler-specific or what, but I figured it was worth noting.</description>
		<content:encoded><![CDATA[<p>I&#8217;m using Code::Blocks, and if I run my program from the last chapter&#8217;s quiz and enter 0 as the second number (named dY in the example answer) and choose the division sign (/), it doesn&#8217;t crash. Rather, it tells me the answer is &#8220;Infinity&#8221;.</p>
<p>I&#8217;m not sure if that&#8217;s compiler-specific or what, but I figured it was worth noting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-73707</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Sat, 05 Dec 2009 22:01:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-73707</guid>
		<description>I&#039;m using this tutorial to teach myself c++.  So far it&#039;s been pretty good.  I have a question about arithmetic operators in regard to powers.  How does one square or cube or pentuple a number without actually mulitplying the number that many times?  In other programing languages one can use the ^ symbol to indicate &quot;raised to the power of&quot;  so that a number square could be represented as x^2 and a pentupled number can be represented as x^5.</description>
		<content:encoded><![CDATA[<p>I&#8217;m using this tutorial to teach myself c++.  So far it&#8217;s been pretty good.  I have a question about arithmetic operators in regard to powers.  How does one square or cube or pentuple a number without actually mulitplying the number that many times?  In other programing languages one can use the ^ symbol to indicate &#8220;raised to the power of&#8221;  so that a number square could be represented as x^2 and a pentupled number can be represented as x^5.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thom</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-71067</link>
		<dc:creator>Thom</dc:creator>
		<pubDate>Mon, 26 Oct 2009 18:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-71067</guid>
		<description>Here&#039;s the briefest answer to #2 I could come up with:

&lt;pre&gt;
bool IsEven(int x)
{
    return !(x % 2);
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Here&#8217;s the briefest answer to #2 I could come up with:</p>
<pre>
bool IsEven(int x)
{
    return !(x % 2);
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: See ++</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-66473</link>
		<dc:creator>See ++</dc:creator>
		<pubDate>Mon, 17 Aug 2009 15:23:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-66473</guid>
		<description>&lt;pre&gt;
#include&lt;iostream&gt;
using namespace std;

bool IsEven(int x);

int main()
{
	int y;
	cout&lt;&lt;&quot;Enter an integer. The program will check if it is even(1) or odd(0): &quot;;
	cin&gt;&gt;y;

	cout&lt;&lt;IsEven(y)&lt;&lt;endl;

	return 0;
}

bool IsEven(int x)
{
	if(x%2==0)
		return true;
	else 
		return false;
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>
#include&lt;iostream&gt;
using namespace std;

bool IsEven(int x);

int main()
{
	int y;
	cout&lt;&lt;&quot;Enter an integer. The program will check if it is even(1) or odd(0): &quot;;
	cin&gt;&gt;y;

	cout&lt;&lt;IsEven(y)&lt;&lt;endl;

	return 0;
}

bool IsEven(int x)
{
	if(x%2==0)
		return true;
	else
		return false;
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: anand chanduri</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-65585</link>
		<dc:creator>anand chanduri</dc:creator>
		<pubDate>Tue, 04 Aug 2009 04:47:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-65585</guid>
		<description>Simplified version of the code

&lt;pre&gt;
#include &lt;iostream&gt;
#define TRUE 1
#define FALSE 0
using namespace std;
int nValue;
int IsEven()  //function to find out if variable nValue entered is odd or even
    {
        return ((nValue%2)&gt;0?FALSE :TRUE);
    }
int main()
    {
        int retVal;
        cout &lt;&lt; &quot;Enter Number: &quot; &lt;&lt; endl;
        cin &gt;&gt; nValue; // Input a number to find out if it is even or odd
        retVal = IsEven();
        if (retVal == TRUE)
        {
        cout &lt;&lt; &quot;Even Number: &quot; &lt;&lt; endl;
        }
        else
        {
        cout &lt;&lt; &quot;ODD Number: &quot; &lt;&lt; endl;
        }
        return 0;
    }


&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Simplified version of the code</p>
<pre>
#include &lt;iostream&gt;
#define TRUE 1
#define FALSE 0
using namespace std;
int nValue;
int IsEven()  //function to find out if variable nValue entered is odd or even
    {
        return ((nValue%2)&gt;0?FALSE :TRUE);
    }
int main()
    {
        int retVal;
        cout &lt;&lt; &quot;Enter Number: &quot; &lt;&lt; endl;
        cin &gt;&gt; nValue; // Input a number to find out if it is even or odd
        retVal = IsEven();
        if (retVal == TRUE)
        {
        cout &lt;&lt; &quot;Even Number: &quot; &lt;&lt; endl;
        }
        else
        {
        cout &lt;&lt; &quot;ODD Number: &quot; &lt;&lt; endl;
        }
        return 0;
    }
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-65536</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Mon, 03 Aug 2009 11:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-65536</guid>
		<description>I got this on first try and it worked.

&lt;pre&gt;
#include &lt;iostream&gt;
using namespace std;
int nValue;
bool IsEven()  //function to find out if variable nValue entered is odd or even
    {
        if (nValue % 2 == 0)
            cout &lt;&lt; &quot;EVEN!&quot; &lt;&lt; endl;
        else
            cout &lt;&lt; &quot;ODD!&quot; &lt;&lt; endl;
        return nValue;
    }
int main()
    {
        cout &lt;&lt; &quot;Enter Number: &quot; &lt;&lt; endl;
        cin &gt;&gt; nValue; // Input a number to find out if it is even or odd
        IsEven();
        return 0;
    }
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I got this on first try and it worked.</p>
<pre>
#include &lt;iostream&gt;
using namespace std;
int nValue;
bool IsEven()  //function to find out if variable nValue entered is odd or even
    {
        if (nValue % 2 == 0)
            cout &lt;&lt; &quot;EVEN!&quot; &lt;&lt; endl;
        else
            cout &lt;&lt; &quot;ODD!&quot; &lt;&lt; endl;
        return nValue;
    }
int main()
    {
        cout &lt;&lt; &quot;Enter Number: &quot; &lt;&lt; endl;
        cin &gt;&gt; nValue; // Input a number to find out if it is even or odd
        IsEven();
        return 0;
    }
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: albino_squirrel</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-65143</link>
		<dc:creator>albino_squirrel</dc:creator>
		<pubDate>Tue, 28 Jul 2009 00:47:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-65143</guid>
		<description>Whenever I use an if statement it generated an error, then I added curly braces at the beginning and end of each if statement and it started working, do you have any idea why?</description>
		<content:encoded><![CDATA[<p>Whenever I use an if statement it generated an error, then I added curly braces at the beginning and end of each if statement and it started working, do you have any idea why?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lfamorim</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-64754</link>
		<dc:creator>lfamorim</dc:creator>
		<pubDate>Wed, 22 Jul 2009 03:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-64754</guid>
		<description>First of all, I&#039;d like to thank you for the tutorial! 

I just want to say that at the title &quot;Modulus (remainer)&quot; there&#039;s a typing error, it should be &quot;Modulus (remainder)&quot;right? :)</description>
		<content:encoded><![CDATA[<p>First of all, I&#8217;d like to thank you for the tutorial! </p>
<p>I just want to say that at the title &#8220;Modulus (remainer)&#8221; there&#8217;s a typing error, it should be &#8220;Modulus (remainder)&#8221;right? :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chiamaka</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-62488</link>
		<dc:creator>Chiamaka</dc:creator>
		<pubDate>Tue, 16 Jun 2009 00:55:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-62488</guid>
		<description>When i tried to compile the program that you made for question 2, it would not compile, there was a problem when it was linking, it said:&quot; 1 unresolved externals&quot;</description>
		<content:encoded><![CDATA[<p>When i tried to compile the program that you made for question 2, it would not compile, there was a problem when it was linking, it said:&#8221; 1 unresolved externals&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
