<?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: 2.6 &#8212; Boolean Values</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/26-boolean-values/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 21:20:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: boolean values</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-96637</link>
		<dc:creator>boolean values</dc:creator>
		<pubDate>Wed, 14 Dec 2011 16:15:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-96637</guid>
		<description>[...]  [...]</description>
		<content:encoded><![CDATA[<p>[...]  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xero</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-96423</link>
		<dc:creator>xero</dc:creator>
		<pubDate>Sun, 20 Nov 2011 18:36:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-96423</guid>
		<description>I want to ask why following code works?

#include 
int main()
{
    using namespace std;
    int x;
    cout &lt;&lt; &quot;Please feed in the first number&quot; &lt;&gt; x;
    int y;
    cout &lt;&lt; &quot;Please feed in the second number&quot; &lt;&gt; y;
    bool z;
    if (x==y)
    z = true;
    else
    z = false;
    if (z)
    cout &lt;&lt; &quot;Both digits are equal&quot; &lt;&lt; endl;
    else
    cout &lt;&lt; &quot;Both digits are different&quot; &lt;&lt; endl;
    return 0;
}

When the user feeds in two different numbers then the statement which says
if (z)
must hold 0 as z and in return should type &quot;Both digits are equal&quot; because this cout statement follows if (z) statement.
Please comment...</description>
		<content:encoded><![CDATA[<p>I want to ask why following code works?</p>
<p>#include<br />
int main()<br />
{<br />
    using namespace std;<br />
    int x;<br />
    cout &lt;&lt; &quot;Please feed in the first number&quot; &lt;&gt; x;<br />
    int y;<br />
    cout &lt;&lt; &quot;Please feed in the second number&quot; &lt;&gt; y;<br />
    bool z;<br />
    if (x==y)<br />
    z = true;<br />
    else<br />
    z = false;<br />
    if (z)<br />
    cout &lt;&lt; &quot;Both digits are equal&quot; &lt;&lt; endl;<br />
    else<br />
    cout &lt;&lt; &quot;Both digits are different&quot; &lt;&lt; endl;<br />
    return 0;<br />
}</p>
<p>When the user feeds in two different numbers then the statement which says<br />
if (z)<br />
must hold 0 as z and in return should type &quot;Both digits are equal&quot; because this cout statement follows if (z) statement.<br />
Please comment&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zingmars</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-95899</link>
		<dc:creator>zingmars</dc:creator>
		<pubDate>Sat, 20 Aug 2011 15:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-95899</guid>
		<description>= - assignment operator, used to assign a specific value to whatever you want to assign to.
== - comparing operator, using to compare 2 things.</description>
		<content:encoded><![CDATA[<p>= &#8211; assignment operator, used to assign a specific value to whatever you want to assign to.<br />
== &#8211; comparing operator, using to compare 2 things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gurbux</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-87221</link>
		<dc:creator>gurbux</dc:creator>
		<pubDate>Sat, 26 Jun 2010 15:51:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-87221</guid>
		<description>hey nice explanation alex very helpfull...........</description>
		<content:encoded><![CDATA[<p>hey nice explanation alex very helpfull&#8230;&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joha</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-87003</link>
		<dc:creator>joha</dc:creator>
		<pubDate>Wed, 23 Jun 2010 00:16:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-87003</guid>
		<description>wouldnt it be the same to put instead of x==y, this: x=y????
i tried and got the same result so.....what is the difference and when do I use each operator????

Thanks..</description>
		<content:encoded><![CDATA[<p>wouldnt it be the same to put instead of x==y, this: x=y????<br />
i tried and got the same result so&#8230;..what is the difference and when do I use each operator????</p>
<p>Thanks..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bertha</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-84261</link>
		<dc:creator>Bertha</dc:creator>
		<pubDate>Fri, 07 May 2010 00:21:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-84261</guid>
		<description>&lt;a href=&quot;http://www.streamgirls18.com&quot; rel=&quot;nofollow&quot;&gt;stream sex&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://www.streamgirls18.com" rel="nofollow">stream sex</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guntis</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-81564</link>
		<dc:creator>Guntis</dc:creator>
		<pubDate>Thu, 25 Mar 2010 16:22:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-81564</guid>
		<description>Yay, I think I completely understand how bool works now.
Thanks Alex, this is so much better than even some of those books on cpp.

P.S. Here&#039;s my little test that succeeded btw.
&lt;pre&gt;
bool isEqual(int x, int y)
{
	return (x == y);
}
int main()
{
	cout &lt;&lt; &quot;Enter a value:\t\t &quot;;
	int x;
	cin &gt;&gt; x;

	cout &lt;&lt; &quot;Enter another value:\t &quot;;
	int y;
	cin &gt;&gt; y;

	if (isEqual(x, y))
		cout &lt;&lt; &quot;Numbers were equal!&quot; &lt;&lt; endl;
	else
		cout &lt;&lt; &quot;Numbers were not equal&quot; &lt;&lt; endl;

	bool bZero(1);

	if (x == 0)
		bZero = 1;
	else 
		if (y == 0)
			bZero = 1;
		else 
			bZero = 0;
	
	if (bZero == 1)
		cout &lt;&lt; &quot;One of numbers was 0&quot; &lt;&lt; endl;
	else 
		return 0;
	

}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Yay, I think I completely understand how bool works now.<br />
Thanks Alex, this is so much better than even some of those books on cpp.</p>
<p>P.S. Here&#8217;s my little test that succeeded btw.</p>
<pre>
bool isEqual(int x, int y)
{
	return (x == y);
}
int main()
{
	cout &lt;&lt; &quot;Enter a value:\t\t &quot;;
	int x;
	cin &gt;&gt; x;

	cout &lt;&lt; &quot;Enter another value:\t &quot;;
	int y;
	cin &gt;&gt; y;

	if (isEqual(x, y))
		cout &lt;&lt; &quot;Numbers were equal!&quot; &lt;&lt; endl;
	else
		cout &lt;&lt; &quot;Numbers were not equal&quot; &lt;&lt; endl;

	bool bZero(1);

	if (x == 0)
		bZero = 1;
	else
		if (y == 0)
			bZero = 1;
		else
			bZero = 0;

	if (bZero == 1)
		cout &lt;&lt; &quot;One of numbers was 0&quot; &lt;&lt; endl;
	else
		return 0;

}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mac</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-81474</link>
		<dc:creator>Mac</dc:creator>
		<pubDate>Thu, 25 Mar 2010 02:42:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-81474</guid>
		<description>Hi, i tried to make this program work with three numbers:

i.e.
return (x == y == z)

the program compiled fine and ran, but did only gave the result for &quot;else&quot; (false)

after i took away &quot;int z&quot; it worked just fine...

does bool only work for two variables?</description>
		<content:encoded><![CDATA[<p>Hi, i tried to make this program work with three numbers:</p>
<p>i.e.<br />
return (x == y == z)</p>
<p>the program compiled fine and ran, but did only gave the result for &#8220;else&#8221; (false)</p>
<p>after i took away &#8220;int z&#8221; it worked just fine&#8230;</p>
<p>does bool only work for two variables?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephan</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-80588</link>
		<dc:creator>Stephan</dc:creator>
		<pubDate>Mon, 15 Mar 2010 10:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-80588</guid>
		<description>Hi Alex (Admin)!

Great site. 
Just wanted to say that I find your site extremely educational, and for me, easy to follow. Good work!

P.S.
I get just as much fun/learning reading the comments at the end of the tutorial as I do from the lessons. I can&#039;t finish a section &lt;em&gt;without&lt;/em&gt; reading the comments!

Brilliant!!!</description>
		<content:encoded><![CDATA[<p>Hi Alex (Admin)!</p>
<p>Great site.<br />
Just wanted to say that I find your site extremely educational, and for me, easy to follow. Good work!</p>
<p>P.S.<br />
I get just as much fun/learning reading the comments at the end of the tutorial as I do from the lessons. I can&#8217;t finish a section <em>without</em> reading the comments!</p>
<p>Brilliant!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dawit</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/comment-page-1/#comment-76491</link>
		<dc:creator>dawit</dc:creator>
		<pubDate>Fri, 15 Jan 2010 11:47:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-76491</guid>
		<description>wath is break;</description>
		<content:encoded><![CDATA[<p>wath is break;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

