<?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: 3.7 &#8212; Converting between binary and decimal</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/</link>
	<description></description>
	<pubDate>Fri, 29 Aug 2008 19:34:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-23417</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 12 Aug 2008 04:26:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-23417</guid>
		<description>I'd say it's not particularly relevant in this case since the range of x falls within both the signed and unsigned int range.</description>
		<content:encoded><![CDATA[<p>I&#8217;d say it&#8217;s not particularly relevant in this case since the range of x falls within both the signed and unsigned int range.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffey</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-23273</link>
		<dc:creator>Jeffey</dc:creator>
		<pubDate>Sun, 10 Aug 2008 06:57:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-23273</guid>
		<description>I should prob use an unsigned int though huh?</description>
		<content:encoded><![CDATA[<p>I should prob use an unsigned int though huh?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffey</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-23272</link>
		<dc:creator>Jeffey</dc:creator>
		<pubDate>Sun, 10 Aug 2008 06:41:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-23272</guid>
		<description>as a practice on further learning how to write code. I made this program that converts decimal to binary. It uses the same technique as the tutorial shows. I mainly did this because most the programs I have made have had a guideline to it. This one I made up all on my own and it is effective for decimal 0-255. I plan on expanding it further include bigger numbers.

Code
#include &#34;stdafx.h&#34;
#include &#60;iostream&#62;
int main();

void DecToBin(int y)
{
	using namespace std;
	for(int x = 256; x /= 2;)
		if(y &#62;= x)
			(cout &#60;&#60; &#34;1&#34;) &#38;&#38; (y -= x);
		else
			cout &#60;&#60; &#34;0&#34;;
	cout &#60;&#60; &#34;nn&#34;;
	main();
}

int main()
{
	using namespace std;
	cout &#60;&#60; &#34;enter a number: &#34;;
	int y;
	cin &#62;&#62; y;
	DecToBin(y);
	return 0;
}</description>
		<content:encoded><![CDATA[<p>as a practice on further learning how to write code. I made this program that converts decimal to binary. It uses the same technique as the tutorial shows. I mainly did this because most the programs I have made have had a guideline to it. This one I made up all on my own and it is effective for decimal 0-255. I plan on expanding it further include bigger numbers.</p>
<p>Code<br />
#include &quot;stdafx.h&quot;<br />
#include &lt;iostream&gt;<br />
int main();</p>
<p>void DecToBin(int y)<br />
{<br />
	using namespace std;<br />
	for(int x = 256; x /= 2;)<br />
		if(y &gt;= x)<br />
			(cout &lt;&lt; &quot;1&quot;) &amp;&amp; (y -= x);<br />
		else<br />
			cout &lt;&lt; &quot;0&quot;;<br />
	cout &lt;&lt; &quot;nn&quot;;<br />
	main();<br />
}</p>
<p>int main()<br />
{<br />
	using namespace std;<br />
	cout &lt;&lt; &quot;enter a number: &quot;;<br />
	int y;<br />
	cin &gt;&gt; y;<br />
	DecToBin(y);<br />
	return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 3.6 &#8212; Logical operators</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-12644</link>
		<dc:creator>Learn C++ - &#187; 3.6 &#8212; Logical operators</dc:creator>
		<pubDate>Wed, 23 Apr 2008 02:37:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-12644</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 3.5 &#8212; Relational operators (comparisons) &#124; Home &#124; 3.7 &#8212; Converting between binary and decimal &#187;     Friday, June 15th, 2007 at 1:35 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 3.5 &#8212; Relational operators (comparisons) | Home | 3.7 &#8212; Converting between binary and decimal &raquo;     Friday, June 15th, 2007 at 1:35 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 3.8 &#8212; Bitwise operators</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-12613</link>
		<dc:creator>Learn C++ - &#187; 3.8 &#8212; Bitwise operators</dc:creator>
		<pubDate>Wed, 23 Apr 2008 01:53:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-12613</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 3.7 &#8212; Converting between binary and decimal &#124; Home &#124; 4.1 &#8212; Blocks (compound statements) and local variables &#187;     Sunday, June [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 3.7 &#8212; Converting between binary and decimal | Home | 4.1 &#8212; Blocks (compound statements) and local variables &raquo;     Sunday, June [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-5702</link>
		<dc:creator>Abhishek</dc:creator>
		<pubDate>Tue, 08 Jan 2008 08:34:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-5702</guid>
		<description>Thanks.......I thought u r gonna put me in a jail for spamming!! lol</description>
		<content:encoded><![CDATA[<p>Thanks&#8230;&#8230;.I thought u r gonna put me in a jail for spamming!! lol</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-5694</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 08 Jan 2008 05:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-5694</guid>
		<description>That's definitely a faster way to do it in practice.  An even faster way is to use windows calculator (or another program). ;)

(To use windows calculator in this manner, go to the View menu and choose "scientific" -- then you can access the Dec and Bin buttons, which are decimal and binary).

The wordpress spam filter does a really good job of catching stuff, but it occasionally gets false positives.  I restored the version of your article that it marked as spam and told it that it wasn't spam.  It's supposed to learn from past behavior, so hopefully next time it will be smarter about how to treat wikihow links.</description>
		<content:encoded><![CDATA[<p>That&#8217;s definitely a faster way to do it in practice.  An even faster way is to use windows calculator (or another program). ;)</p>
<p>(To use windows calculator in this manner, go to the View menu and choose &#8220;scientific&#8221; &#8212; then you can access the Dec and Bin buttons, which are decimal and binary).</p>
<p>The wordpress spam filter does a really good job of catching stuff, but it occasionally gets false positives.  I restored the version of your article that it marked as spam and told it that it wasn&#8217;t spam.  It&#8217;s supposed to learn from past behavior, so hopefully next time it will be smarter about how to treat wikihow links.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-5688</link>
		<dc:creator>Abhishek</dc:creator>
		<pubDate>Tue, 08 Jan 2008 05:29:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-5688</guid>
		<description>Thanks!!Thats a good revision of what i had learnt in school 3 yrs ago......

But I prefer this method for decimal to binary conversion::
&lt;b&gt;Short division by two with remainder&lt;/b&gt;

This method is much easier to understand when visualized on paper. It relies only on division by two.

   1. For this example, let's convert the decimal number 156 to binary. Write the decimal number as the dividend inside an upside-down "long division" symbol. Write the base of the destination system (in our case, "2" for binary) as the divisor outside the curve of the division symbol.

      2)156
   2. Write the integer answer (quotient) under the long division symbol, and write the reminader (0 or 1) to the right of the dividend.

      2)156   0
         78
   3. Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is 1.

      2)156   0
       2)78   0
       2)39   1
       2)19   1
        2)9   1
        2)4   0
        2)2   0
          1
   4. Starting with the bottom 1, read the sequence of 1's and 0's upwards to the top. You should have 10011100. This is the binary equivalent of the decimal number 156.


source:
http://www.wikihow.com/Convert-from-Decimal-to-Binary</description>
		<content:encoded><![CDATA[<p>Thanks!!Thats a good revision of what i had learnt in school 3 yrs ago&#8230;&#8230;</p>
<p>But I prefer this method for decimal to binary conversion::<br />
<b>Short division by two with remainder</b></p>
<p>This method is much easier to understand when visualized on paper. It relies only on division by two.</p>
<p>   1. For this example, let&#8217;s convert the decimal number 156 to binary. Write the decimal number as the dividend inside an upside-down &#8220;long division&#8221; symbol. Write the base of the destination system (in our case, &#8220;2&#8243; for binary) as the divisor outside the curve of the division symbol.</p>
<p>      2)156<br />
   2. Write the integer answer (quotient) under the long division symbol, and write the reminader (0 or 1) to the right of the dividend.</p>
<p>      2)156   0<br />
         78<br />
   3. Continue downwards, dividing each new quotient by two and writing the remainders to the right of each dividend. Stop when the quotient is 1.</p>
<p>      2)156   0<br />
       2)78   0<br />
       2)39   1<br />
       2)19   1<br />
        2)9   1<br />
        2)4   0<br />
        2)2   0<br />
          1<br />
   4. Starting with the bottom 1, read the sequence of 1&#8217;s and 0&#8217;s upwards to the top. You should have 10011100. This is the binary equivalent of the decimal number 156.</p>
<p>source:<br />
<a href="http://www.wikihow.com/Convert-from-Decimal-to-Binary" rel="nofollow">http://www.wikihow.com/Convert-from-Decimal-to-Binary</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cody</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-4789</link>
		<dc:creator>Cody</dc:creator>
		<pubDate>Sat, 22 Dec 2007 15:05:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-4789</guid>
		<description>Why do you say converting -11 to binary but then use a 76?

[ It should have been converting -76 to binary.  Fixed!  -Alex ]</description>
		<content:encoded><![CDATA[<p>Why do you say converting -11 to binary but then use a 76?</p>
<p>[ It should have been converting -76 to binary.  Fixed!  -Alex ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Faiz ur Rehman</title>
		<link>http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-2872</link>
		<dc:creator>Faiz ur Rehman</dc:creator>
		<pubDate>Fri, 16 Nov 2007 14:30:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/37-converting-between-binary-and-decimal/#comment-2872</guid>
		<description>I have problem in binary Numbers &#38; Logic Operations. can you help me to soulation of binary and decmal.
Thanks
Faiz

[ Try the &lt;a href="http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/" rel="nofollow"&gt;lesson on bitwise operators&lt;/a&gt;. -Alex ]</description>
		<content:encoded><![CDATA[<p>I have problem in binary Numbers &amp; Logic Operations. can you help me to soulation of binary and decmal.<br />
Thanks<br />
Faiz</p>
<p>[ Try the <a href="http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/" rel="nofollow">lesson on bitwise operators</a>. -Alex ]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
