<?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>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: profanegod</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-96652</link>
		<dc:creator>profanegod</dc:creator>
		<pubDate>Fri, 16 Dec 2011 05:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-96652</guid>
		<description>bacia - it&#039;s pretty easy to formulate best guesses on square roots.  It has to do with averaging the quotients and guesses. Here&#039;s a mathematical example.

Find sqrt(9):

Guess1: 1   9/1 = 9
Average1: (9+1)/2 = 5

Guess2: 5   9/5 = 1.8
Average2: (5+1.8)/2 = 3.4

Guess3: 3.4  9/3.4 = 2.647
Average3: (2.647+3.4)/2 = 3.0235

Guess4: 3.0235   9/3.0235 = 2.977
Average4: (3.0235+2.977)/2 = 3.00025


As you can see the answer for principal roots by this method aren&#039;t as clean as they can be.  But this process can be done on a computer with a high degree of precision after only a few iterations.  Pretty much all you will need is a for or while loop (or recursive procedure), and the + and / operators.</description>
		<content:encoded><![CDATA[<p>bacia &#8211; it&#8217;s pretty easy to formulate best guesses on square roots.  It has to do with averaging the quotients and guesses. Here&#8217;s a mathematical example.</p>
<p>Find sqrt(9):</p>
<p>Guess1: 1   9/1 = 9<br />
Average1: (9+1)/2 = 5</p>
<p>Guess2: 5   9/5 = 1.8<br />
Average2: (5+1.8)/2 = 3.4</p>
<p>Guess3: 3.4  9/3.4 = 2.647<br />
Average3: (2.647+3.4)/2 = 3.0235</p>
<p>Guess4: 3.0235   9/3.0235 = 2.977<br />
Average4: (3.0235+2.977)/2 = 3.00025</p>
<p>As you can see the answer for principal roots by this method aren&#8217;t as clean as they can be.  But this process can be done on a computer with a high degree of precision after only a few iterations.  Pretty much all you will need is a for or while loop (or recursive procedure), and the + and / operators.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bacia</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-96535</link>
		<dc:creator>bacia</dc:creator>
		<pubDate>Fri, 02 Dec 2011 16:10:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-96535</guid>
		<description>Unfortunately I can&#039;t make a program which solves quadratic equations without square roots or powers because the quadratic formula uses a square root. bummer</description>
		<content:encoded><![CDATA[<p>Unfortunately I can&#8217;t make a program which solves quadratic equations without square roots or powers because the quadratic formula uses a square root. bummer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bacia</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-96534</link>
		<dc:creator>bacia</dc:creator>
		<pubDate>Fri, 02 Dec 2011 15:41:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-96534</guid>
		<description>Are there operators for percents, powers, and roots?</description>
		<content:encoded><![CDATA[<p>Are there operators for percents, powers, and roots?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RobP</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-96050</link>
		<dc:creator>RobP</dc:creator>
		<pubDate>Tue, 20 Sep 2011 15:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-96050</guid>
		<description>Here&#039;s my attempt at the even/odd program. Works pretty well. Side effects may include nausea, vomiting, heartburn, burning urination, and the desire to consider Rick Perry a valid presidential candidate. Ask your doctor if RobP&#039;s solution is right for you.

// Workbench.cpp : Space to test snippets or programs that don&#039;t need to be saved.
#include &quot;stdafx.h&quot;
#include 

int main()
{
    using namespace std;

   int x;
   cout &lt;&lt; &quot;Enter a number:&quot; &lt;&gt; x;
   if (x % 2 == 0)
	   cout &lt;&lt; &quot;You entered &quot; &lt;&lt; x &lt;&lt; &quot; which is even.&quot; &lt;&lt; endl;
   else cout &lt;&lt; &quot;You entered &quot; &lt;&lt; x &lt;&lt; &quot; which is odd.&quot; &lt;&lt; endl;

   return 0;
} // end of main()</description>
		<content:encoded><![CDATA[<p>Here&#8217;s my attempt at the even/odd program. Works pretty well. Side effects may include nausea, vomiting, heartburn, burning urination, and the desire to consider Rick Perry a valid presidential candidate. Ask your doctor if RobP&#8217;s solution is right for you.</p>
<p>// Workbench.cpp : Space to test snippets or programs that don&#8217;t need to be saved.<br />
#include &#8220;stdafx.h&#8221;<br />
#include </p>
<p>int main()<br />
{<br />
    using namespace std;</p>
<p>   int x;<br />
   cout &lt;&lt; &quot;Enter a number:&quot; &lt;&gt; x;<br />
   if (x % 2 == 0)<br />
	   cout &lt;&lt; &quot;You entered &quot; &lt;&lt; x &lt;&lt; &quot; which is even.&quot; &lt;&lt; endl;<br />
   else cout &lt;&lt; &quot;You entered &quot; &lt;&lt; x &lt;&lt; &quot; which is odd.&quot; &lt;&lt; endl;</p>
<p>   return 0;<br />
} // end of main()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sachinbhanushali</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-95630</link>
		<dc:creator>sachinbhanushali</dc:creator>
		<pubDate>Sun, 26 Jun 2011 10:49:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-95630</guid>
		<description>Visit &lt;a href=&quot;http://www.computereducation.co.cc&quot; title=&quot;computer education The IT Blog&quot; rel=&quot;nofollow&quot;&gt; The IT Blog for eBooks N Solutions with Lots of Hacking Tricks</description>
		<content:encoded><![CDATA[<p>Visit <a href="http://www.computereducation.co.cc" title="computer education The IT Blog" rel="nofollow"> The IT Blog for eBooks N Solutions with Lots of Hacking Tricks</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sachinbhanushali</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-95629</link>
		<dc:creator>sachinbhanushali</dc:creator>
		<pubDate>Sun, 26 Jun 2011 10:46:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-95629</guid>
		<description>VISIT &lt;a href=&quot;http://www.computereducation.co.cc&quot; title=&quot;The IT Blog&quot; rel=&quot;nofollow&quot;&gt; and get all eBooks N Solutions free for download</description>
		<content:encoded><![CDATA[<p>VISIT <a href="http://www.computereducation.co.cc" title="The IT Blog" rel="nofollow"> and get all eBooks N Solutions free for download</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: C++ Tutorial and Online Ebook</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-87425</link>
		<dc:creator>C++ Tutorial and Online Ebook</dc:creator>
		<pubDate>Wed, 30 Jun 2010 01:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-87425</guid>
		<description>[...] 3.2 Arithmetic operators [...]</description>
		<content:encoded><![CDATA[<p>[...] 3.2 Arithmetic operators [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kush</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-85748</link>
		<dc:creator>Kush</dc:creator>
		<pubDate>Tue, 01 Jun 2010 09:09:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-85748</guid>
		<description>In your code, I presumed your casting was done to prevent errors, which occurs when a character is enetered when we ask for integer. 
It generally crashed out programs... and I never knew how to get around it...
so, a little help in this program would be appreciated.</description>
		<content:encoded><![CDATA[<p>In your code, I presumed your casting was done to prevent errors, which occurs when a character is enetered when we ask for integer.<br />
It generally crashed out programs&#8230; and I never knew how to get around it&#8230;<br />
so, a little help in this program would be appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephan</title>
		<link>http://www.learncpp.com/cpp-tutorial/32-arithmetic-operators/comment-page-1/#comment-80664</link>
		<dc:creator>Stephan</dc:creator>
		<pubDate>Tue, 16 Mar 2010 08:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/uncategorized/32-arithmetic-operators/#comment-80664</guid>
		<description>Just an aside.

I&#039;m using Code::Blocks and I try out many of the examples of code offered up by contributors (excellent stuff - teaches me loads of what not to do . . . ;-)) and examples in the tutorials.
I noticed that the terminal window says &quot;Process returned 0   execution time : 3.102 s(or what ever)&quot; Yet the program seems to be instant (certainly not X seconds) . . . Just curious.

Prince of Darkness
Me + Electrickery = Smoke ;-)</description>
		<content:encoded><![CDATA[<p>Just an aside.</p>
<p>I&#8217;m using Code::Blocks and I try out many of the examples of code offered up by contributors (excellent stuff &#8211; teaches me loads of what not to do . . . ;-)) and examples in the tutorials.<br />
I noticed that the terminal window says &#8220;Process returned 0   execution time : 3.102 s(or what ever)&#8221; Yet the program seems to be instant (certainly not X seconds) . . . Just curious.</p>
<p>Prince of Darkness<br />
Me + Electrickery = Smoke ;-)</p>
]]></content:encoded>
	</item>
	<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>
</channel>
</rss>

