<?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"
	>
<channel>
	<title>Comments on: 5.2 &#8212; If statements</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/52-if-statements/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/</link>
	<description></description>
	<pubDate>Wed, 20 Aug 2008 08:29:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Ameya Shashank</title>
		<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-21516</link>
		<dc:creator>Ameya Shashank</dc:creator>
		<pubDate>Tue, 22 Jul 2008 16:02:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-21516</guid>
		<description>Sorry, this is correct code.

using namespace std;
	cout &#60;&#62; nX;
	cout &#60;&#60; "You entered " &#60;&#60; nX &#60;&#60; endl;

	using namespace std;
	cout &#60;&#62; nY;
	cout &#60;&#60; "You entered " &#60;&#60; nY &#60; nY)
		cout &#60;&#60; nX &#60;&#60; " is greater than " &#60;&#60; nY &#60;&#60; endl;
	else if (nX &#60; nY)
		cout &#60;&#60; nX &#60;&#60; " is less than " &#60;&#60; nY &#60;&#60; endl;
	else if (nX = nY)
		cout &#60;&#60; nX &#60;&#60; " is equal to " &#60;&#60; nY &#60;&#60; endl;</description>
		<content:encoded><![CDATA[<p>Sorry, this is correct code.</p>
<p>using namespace std;<br />
	cout &lt;&gt; nX;<br />
	cout &lt;&lt; &#8220;You entered &#8221; &lt;&lt; nX &lt;&lt; endl;</p>
<p>	using namespace std;<br />
	cout &lt;&gt; nY;<br />
	cout &lt;&lt; &#8220;You entered &#8221; &lt;&lt; nY &lt; nY)<br />
		cout &lt;&lt; nX &lt;&lt; &#8221; is greater than &#8221; &lt;&lt; nY &lt;&lt; endl;<br />
	else if (nX &lt; nY)<br />
		cout &lt;&lt; nX &lt;&lt; &#8221; is less than &#8221; &lt;&lt; nY &lt;&lt; endl;<br />
	else if (nX = nY)<br />
		cout &lt;&lt; nX &lt;&lt; &#8221; is equal to &#8221; &lt;&lt; nY &lt;&lt; endl;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ameya Shashank</title>
		<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-21515</link>
		<dc:creator>Ameya Shashank</dc:creator>
		<pubDate>Tue, 22 Jul 2008 15:59:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-21515</guid>
		<description>I'm trying to write a code, in which the user will enter a number, enter another number than write whether the 1st number was greater than, less than, or equal to, the 2nd number number. All numbers work, except when the 1st and 2nd numbers are both 0. In that case, it says nothing. My code is below; can you see the problem?

using namespace std;
	cout &#60;&#62; nX;
	cout &#60;&#60; "You entered " &#60;&#60; nX &#60;&#60; endl;

using namespace std;
	cout &#60;&#62; nY;
	cout &#60;&#60; "You entered " &#60;&#60; nY &#60; nY)
		cout &#60;&#60; nX &#60;&#60; " is greater than " &#60;&#60; nY &#60;&#60; endl;
	else if (nX &#60; nY)
		cout &#60;&#60; nX &#60;&#60; " is less than " &#60;&#60; nY &#60;&#60; endl;
	else if (nX = nY)
		cout &#60;&#60; nX &#60;&#60; " is equal to " &#60;&#60; nY &#60;&#60; endl;
Thanks.</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to write a code, in which the user will enter a number, enter another number than write whether the 1st number was greater than, less than, or equal to, the 2nd number number. All numbers work, except when the 1st and 2nd numbers are both 0. In that case, it says nothing. My code is below; can you see the problem?</p>
<p>using namespace std;<br />
	cout &lt;&gt; nX;<br />
	cout &lt;&lt; &#8220;You entered &#8221; &lt;&lt; nX &lt;&lt; endl;</p>
<p>using namespace std;<br />
	cout &lt;&gt; nY;<br />
	cout &lt;&lt; &#8220;You entered &#8221; &lt;&lt; nY &lt; nY)<br />
		cout &lt;&lt; nX &lt;&lt; &#8221; is greater than &#8221; &lt;&lt; nY &lt;&lt; endl;<br />
	else if (nX &lt; nY)<br />
		cout &lt;&lt; nX &lt;&lt; &#8221; is less than &#8221; &lt;&lt; nY &lt;&lt; endl;<br />
	else if (nX = nY)<br />
		cout &lt;&lt; nX &lt;&lt; &#8221; is equal to &#8221; &lt;&lt; nY &lt;&lt; endl;<br />
Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 5.3 &#8212; Switch statements</title>
		<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-20681</link>
		<dc:creator>Learn C++ - &#187; 5.3 &#8212; Switch statements</dc:creator>
		<pubDate>Fri, 11 Jul 2008 01:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-20681</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 5.2 &#8212; If statements &#124; Home &#124; 5.4 &#8212; Goto statements &#187;     Thursday, June 21st, 2007 at 6:41 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 5.2 &#8212; If statements | Home | 5.4 &#8212; Goto statements &raquo;     Thursday, June 21st, 2007 at 6:41 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 5.1 &#8212; Control flow introduction</title>
		<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-13464</link>
		<dc:creator>Learn C++ - &#187; 5.1 &#8212; Control flow introduction</dc:creator>
		<pubDate>Tue, 29 Apr 2008 04:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-13464</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 4.7 &#8212; Structs &#124; Home &#124; 5.2 &#8212; If statements &#187;     Wednesday, June 20th, 2007 at 9:37 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 4.7 &#8212; Structs | Home | 5.2 &#8212; If statements &raquo;     Wednesday, June 20th, 2007 at 9:37 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-11547</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 12 Apr 2008 22:18:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-11547</guid>
		<description>First off, = is for assignment, not comparison.  You would normally use == to do comparisons, except == doesn't work on string literals (which is anything inside double quotes).  Probably the best way is to declare your a variable as a std::string instead of a char.  Then it will work as you expect.  This is covered in &lt;a href="http://www.learncpp.com/cpp-tutorial/66-c-style-strings/" rel="nofollow"&gt;lesson 6.6&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>First off, = is for assignment, not comparison.  You would normally use == to do comparisons, except == doesn&#8217;t work on string literals (which is anything inside double quotes).  Probably the best way is to declare your a variable as a std::string instead of a char.  Then it will work as you expect.  This is covered in <a href="http://www.learncpp.com/cpp-tutorial/66-c-style-strings/" rel="nofollow">lesson 6.6</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louie Hancock</title>
		<link>http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-11351</link>
		<dc:creator>Louie Hancock</dc:creator>
		<pubDate>Thu, 10 Apr 2008 18:31:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/52-if-statements/#comment-11351</guid>
		<description>Hi, great website btw!
However, whenever i try to use a char variable in an if statement (e.g : 

if(a = "Hello")
cout &#60;&#60; "Hello there";

it does not compile correctly.

can anyone help? if so please email me on fight.the.purple@hotmail.co.uk or leave a comment

many thanks</description>
		<content:encoded><![CDATA[<p>Hi, great website btw!<br />
However, whenever i try to use a char variable in an if statement (e.g : </p>
<p>if(a = &#8220;Hello&#8221;)<br />
cout &lt;&lt; &#8220;Hello there&#8221;;</p>
<p>it does not compile correctly.</p>
<p>can anyone help? if so please email me on <a href="mailto:fight.the.purple@hotmail.co.uk">fight.the.purple@hotmail.co.uk</a> or leave a comment</p>
<p>many thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
