<?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: 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>
	<pubDate>Thu, 24 Jul 2008 16:22:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Learn C++ - &#187; 2.7 &#8212; Chars</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-12600</link>
		<dc:creator>Learn C++ - &#187; 2.7 &#8212; Chars</dc:creator>
		<pubDate>Wed, 23 Apr 2008 01:46:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-12600</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 2.6 &#8212; Boolean Values &#124; Home &#124; 2.8 &#8212; Constants &#187;     Saturday, June 9th, 2007 at 7:07 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 2.6 &#8212; Boolean Values | Home | 2.8 &#8212; Constants &raquo;     Saturday, June 9th, 2007 at 7:07 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-9134</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 08 Mar 2008 22:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-9134</guid>
		<description>When trying to cin boolean values, if the user enters the number 0, this will be treated as the value false.  If the user enters anything else, it will be treated as the value true.

There are several ways to proceed:
* Tell the user to enter 0 for no and 1 for yes and then cin a bool.
* Tell the user to enter 'y' or 'n' and then cin a character.

Once you get to the lesson on strings, you could also do this:
* Tell the user to enter "yes" or "no" and then cin a string.</description>
		<content:encoded><![CDATA[<p>When trying to cin boolean values, if the user enters the number 0, this will be treated as the value false.  If the user enters anything else, it will be treated as the value true.</p>
<p>There are several ways to proceed:<br />
* Tell the user to enter 0 for no and 1 for yes and then cin a bool.<br />
* Tell the user to enter &#8216;y&#8217; or &#8216;n&#8217; and then cin a character.</p>
<p>Once you get to the lesson on strings, you could also do this:<br />
* Tell the user to enter &#8220;yes&#8221; or &#8220;no&#8221; and then cin a string.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: programmer</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-9132</link>
		<dc:creator>programmer</dc:creator>
		<pubDate>Sat, 08 Mar 2008 20:49:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-9132</guid>
		<description>I have problem actually I don't know how to use the boolean with  ( cin ) .. 

like this example:

if i want to ask some one about his car ?

===========
bool car;

&lt;pre&gt;
&lt;&lt; 
====================
cout &lt;&lt; " IS your car new or not ? " ;
cin &gt;&gt; car; 
===================
&lt;/pre&gt;

===== 
is the above good solution or not ?? 

...

i'm witing for your answer 

thank you so much</description>
		<content:encoded><![CDATA[<p>I have problem actually I don&#8217;t know how to use the boolean with  ( cin ) .. </p>
<p>like this example:</p>
<p>if i want to ask some one about his car ?</p>
<p>===========<br />
bool car;</p>
<pre>
< <
====================
cout << " IS your car new or not ? " ;
cin >> car;
===================
</pre>
<p>=====<br />
is the above good solution or not ?? </p>
<p>&#8230;</p>
<p>i&#8217;m witing for your answer </p>
<p>thank you so much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-9041</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 07 Mar 2008 06:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-9041</guid>
		<description>IsEqual function isn't a bool, it returns a bool.  Boolean values are used to represent values that can only be true or false.  When we're talking about whether a value is equal, either it is (true), or it isn't (false).  Consequently, it makes more sense to return a bool than an int.  While technically returning an int would work (returning the value 1 if the parameters are equal, and 0 otherwise), returning a bool is more intuitive and leaves less room for errors to be made.</description>
		<content:encoded><![CDATA[<p>IsEqual function isn&#8217;t a bool, it returns a bool.  Boolean values are used to represent values that can only be true or false.  When we&#8217;re talking about whether a value is equal, either it is (true), or it isn&#8217;t (false).  Consequently, it makes more sense to return a bool than an int.  While technically returning an int would work (returning the value 1 if the parameters are equal, and 0 otherwise), returning a bool is more intuitive and leaves less room for errors to be made.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: some guy</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-9038</link>
		<dc:creator>some guy</dc:creator>
		<pubDate>Fri, 07 Mar 2008 04:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-9038</guid>
		<description>I'm confused as to why you make the IsEqual function a bool, wouldn't making it an int function work just as well? Or is it declared as a bool function so you have an idea of what the return values will be and what the function does? Sorry if I sound like a newbie :p</description>
		<content:encoded><![CDATA[<p>I&#8217;m confused as to why you make the IsEqual function a bool, wouldn&#8217;t making it an int function work just as well? Or is it declared as a bool function so you have an idea of what the return values will be and what the function does? Sorry if I sound like a newbie :p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-5722</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 08 Jan 2008 20:14:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-5722</guid>
		<description>My personal preference is that variable names start with lower case and function (and class) names start with upper case.  This makes them easier to distinguish.</description>
		<content:encoded><![CDATA[<p>My personal preference is that variable names start with lower case and function (and class) names start with upper case.  This makes them easier to distinguish.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Renu</title>
		<link>http://www.learncpp.com/cpp-tutorial/26-boolean-values/#comment-5718</link>
		<dc:creator>Renu</dc:creator>
		<pubDate>Tue, 08 Jan 2008 18:38:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=42#comment-5718</guid>
		<description>Correct me if I am wrong .Shouldnt function name be "isEqual" instead of "IsEqual"? or that convention mostly applies to variable names.</description>
		<content:encoded><![CDATA[<p>Correct me if I am wrong .Shouldnt function name be &#8220;isEqual&#8221; instead of &#8220;IsEqual&#8221;? or that convention mostly applies to variable names.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
