<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C ++ &#187; Byte</title>
	<atom:link href="http://www.bizzymicbizness.com/cplusplus/tag/byte/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bizzymicbizness.com/cplusplus</link>
	<description>All about C++</description>
	<lastBuildDate>Mon, 19 Oct 2009 12:38:17 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Short Integers</title>
		<link>http://www.bizzymicbizness.com/cplusplus/short-integers</link>
		<comments>http://www.bizzymicbizness.com/cplusplus/short-integers#comments</comments>
		<pubDate>Mon, 07 Sep 2009 12:18:38 +0000</pubDate>
		<dc:creator>BMB</dc:creator>
				<category><![CDATA[Variable and Data Types]]></category>
		<category><![CDATA[65535]]></category>
		<category><![CDATA[Byte]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[Short Integers]]></category>

		<guid isPermaLink="false">http://www.bizzymicbizness.com/cplusplus/?p=290</guid>
		<description><![CDATA[A word

Which is a group of 16 contiguous bits or 2 bytes, is used to represent a natural number
As we have studied, the maximum numeric value that can fit in a word is 65535
Since the Byte is used only to represent a character, whenever you plan to use a number in your program, the minimum [...]]]></description>
			<content:encoded><![CDATA[<p>A word</p>
<ul>
<li>Which is a group of 16 contiguous bits or 2 bytes, is used to represent a natural number</li>
<li>As we have studied, the maximum numeric value that can fit in a word is 65535</li>
<li>Since the Byte is used only to represent a character, whenever you plan to use a number in your program, the minimum representation you should/must use is a word</li>
</ul>
<p><br class="blank" /><br />
An algebraic natural number</p>
<ul>
<li>Is also called an integer</li>
</ul>
<p><br class="blank" /><br />
The smallest integer you can store in a word</p>
<ul>
<li>Is declared with the <strong>short</strong> keyword followed by a name</li>
</ul>
<p><br class="blank" /><br />
A <strong>short</strong> integer is <strong>signed</strong> by default</p>
<ul>
<li>It can store a value that ranges from –32768 to 32767</li>
<li>Here is an example program that uses two <strong>short</strong> integers (A-1):</li>
</ul>
<p><br class="blank" /><br />
Example of (A-1)</p>

<div class="syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;iostream&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
&nbsp;
	<span style="color: #0000ff;">short</span> number1, number2<span style="color: #008080;">;</span>
&nbsp;
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Enter a number between -32768 and 32767: &quot;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cin</span> <span style="color: #000080;">&gt;&gt;</span> number1<span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Enter another number: &quot;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cin</span> <span style="color: #000080;">&gt;&gt;</span> number2<span style="color: #008080;">;</span>
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>The numbers you entered were<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Number 1: &quot;</span> <span style="color: #000080;">&lt;&lt;</span> number1 <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>Number 2: &quot;</span> <span style="color: #000080;">&lt;&lt;</span> number2 <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><br class="blank" /> <br />
By default, a <strong>short</strong> integer</p>
<ul>
<li>Is <strong>signed</strong></li>
<li>You can also explicitly declare such a variable as a <strong>signed short</strong></li>
<li>Here is an example (A-2):</li>
</ul>
<p><br class="blank" /> <br />
Example of (A-2)</p>

<div class="syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">signed</span> <span style="color: #0000ff;">short</span> XCoord<span style="color: #008080;">;</span></pre></div></div>

<p><br class="blank" /><br />
If the integer must be positive</p>
<ul>
<li>You should declared as an <strong>unsigned short</strong></li>
</ul>
<p><br class="blank" /><br />
The <strong>unsigned short</strong> is used</p>
<ul>
<li>To identify a 16-bit positive integer whose value would range from 0 to 65535</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.bizzymicbizness.com/cplusplus/short-integers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Representing a Byte</title>
		<link>http://www.bizzymicbizness.com/cplusplus/representing-a-byte</link>
		<comments>http://www.bizzymicbizness.com/cplusplus/representing-a-byte#comments</comments>
		<pubDate>Sun, 30 Aug 2009 09:57:25 +0000</pubDate>
		<dc:creator>BMB</dc:creator>
				<category><![CDATA[Variable and Data Types]]></category>
		<category><![CDATA[256]]></category>
		<category><![CDATA[ASCII]]></category>
		<category><![CDATA[Byte]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Characters]]></category>
		<category><![CDATA[HI nibble]]></category>
		<category><![CDATA[HIBIT]]></category>
		<category><![CDATA[High Order bit]]></category>
		<category><![CDATA[High Order nibble]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[LO nibble]]></category>
		<category><![CDATA[LOBIT]]></category>
		<category><![CDATA[Low Order bit]]></category>
		<category><![CDATA[Low Order nibble]]></category>
		<category><![CDATA[Nibble]]></category>

		<guid isPermaLink="false">http://www.bizzymicbizness.com/cplusplus/?p=233</guid>
		<description><![CDATA[(Image-1) Byte
 

A byte

Is a group of eight consecutive bits (Image-1)
The bits are counted from right to left starting at 0
Is considered as being made of two nibbles (Image-2)


 The most right bit

Is bit 0
It is called the least significant bit
It is also referred to as the Low Order bit, the LO bit, or LOBIT


The most left [...]]]></description>
			<content:encoded><![CDATA[<p>(Image-1) Byte</p>
<p style="TEXT-ALIGN: center"> <img class="size-full wp-image-234 aligncenter" title="Byte" src="http://www.bizzymicbizness.com/cplusplus/wp-content/uploads/2009/08/Byte1.jpg" alt="Byte" width="336" height="174" /></p>
<p><br class="blank" /><br />
A byte</p>
<ul>
<li>Is a group of eight consecutive bits (Image-1)</li>
<li>The bits are counted from right to left starting at 0</li>
<li>Is considered as being made of two nibbles (Image-2)</li>
</ul>
<p><br class="blank" /><br />
 The most right bit</p>
<ul>
<li>Is bit 0</li>
<li>It is called the least significant bit</li>
<li>It is also referred to as the Low Order bit, the LO bit, or <strong>LOBIT</strong></li>
</ul>
<p><br class="blank" /><br />
The most left bit</p>
<ul>
<li>Is bit 7</li>
<li>It is called the most significant bit</li>
<li>It is also referred to as the High Order bit, the HI bit, or <strong>HIBIT</strong></li>
</ul>
<p><br class="blank" /><br />
The other bits</p>
<ul>
<li>Are referred to following their positions</li>
</ul>
<p><br class="blank" /><br />
(Image-2)</p>
<p style="TEXT-ALIGN: center"> <img class="aligncenter size-full wp-image-235" title="Two nibbles" src="http://www.bizzymicbizness.com/cplusplus/wp-content/uploads/2009/08/Byte2.jpg" alt="Two nibbles" width="512" height="222" /></p>
<p><br class="blank" /><br />
The right nibble (Image-2)</p>
<ul>
<li>Made of the right 4 bits</li>
<li>Is called the Low Order nibble or LO nibble</li>
</ul>
<p><br class="blank" /><br />
The left nibble (Image-2)</p>
<ul>
<li>made of the left 4 bits</li>
<li>Is called the High Order nibble or HI nibble</li>
</ul>
<p><br class="blank" /><br />
Using the binary system</p>
<ul>
<li>you can represent the byte using a combination of 0s and 1s (B-1)</li>
</ul>
<p><br class="blank" /><br />
(B-1) When all bits have a value of 0</p>
<ul>
<li>The byte is represented as 00000000</li>
</ul>
<p><br class="blank" /><br />
(B-1) When all bits have a value of 1</p>
<ul>
<li>The byte is represented as 11111111</li>
</ul>
<p><br class="blank" /><br />
When the number grows very large</p>
<ul>
<li>It becomes difficult to read. Therefore, we will represent bits in groups of four (B-2)</li>
</ul>
<p><br class="blank" /><br />
(B-2) Instead of writing 00000000</p>
<ul>
<li>We will write it as  0000 0000</li>
</ul>
<p><br class="blank" /><br />
Create combinations of bits using the boxes as we did for the nibble</p>
<ul>
<li>2<sup>8</sup>, which is 256.</li>
<li>There are 256 possible combinations.</li>
</ul>
<p><br class="blank" /><br />
Another way to find it out is by using the base 2 technique:</p>
<ul>
<li>2<sup>7</sup> + 2<sup>6</sup> + 2<sup>5</sup> + 2<sup>4</sup> + 2<sup>3</sup> + 2<sup>2</sup> + 2<sup>1</sup> + 2<sup>0</sup><br />
= 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1<br />
= 255</li>
<li>Therefore, the maximum decimal value you can store in a byte is 255</li>
</ul>
<p><br class="blank" /><br />
Remember that the byte with all bits having a value of 0</p>
<ul>
<li>Has its value set to 0</li>
<li>Since this byte also holds a valid value, the number of combinations = 255 + 1 = 256</li>
</ul>
<p><br class="blank" /><br />
When a byte is completely represented with 0s</p>
<ul>
<li>It provides the minimum value it can hold</li>
<li>This is 0000 0000, which is also 0</li>
</ul>
<p><br class="blank" /><br />
When all bits have a value of 1</p>
<ul>
<li>Which is 1111 1111, a byte holds its maximum value that we calculated as 255 in the decimal system</li>
<li>As done with the nibble, we get the following table (Image-3):</li>
</ul>
<p><br class="blank" /><br />
(Image-3)</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-237" title="Table" src="http://www.bizzymicbizness.com/cplusplus/wp-content/uploads/2009/08/Table.jpg" alt="Table" width="342" height="60" /></p>
<p><br class="blank" /><br />
The minimum storage area offered by the (Intel) computer</p>
<ul>
<li>Is the byte</li>
</ul>
<p><br class="blank" /><br />
As you know already</p>
<ul>
<li>A byte is a group of 8 consecutive bits</li>
</ul>
<p><br class="blank" /><br />
The amount of memory space offered by a byte</p>
<ul>
<li>Can be used to store just a single symbol, such as those you see on your keyboard</li>
</ul>
<p><br class="blank" /><br />
These symbols, also called characters, have been organized</p>
<ul>
<li>The American Standard Code for Information Exchange (ASCII) in a set list</li>
<li>But, ASCII uses only 128 decimal numbers (based on a 7-bit format) to represent symbols counted from 0 to 127</li>
<li>To compensate for the remaining 1 bit, IBM used it to organize special characters, foreign language characters, mathematical symbols, small graphics, etc</li>
<li>Each one of these characters has a decimal, a hexadecimal, and a binary equivalents</li>
</ul>
<p><br class="blank" /><br />
Each one of the characters you see on your keyboard</p>
<ul>
<li>Is represented as a numeric value, but whether it appears as a number, a letter, or a symbol, each one of these is considered a character</li>
</ul>
<p><br class="blank" /><br />
To display any character on your screen</p>
<ul>
<li>you can use the <strong>cout &lt;&lt;</strong> operator and include the character between single-quotes, as (A-1)</li>
</ul>
<p><br class="blank" /><br />
Example of (A-1)</p>

<div class="syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;iostream&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
&nbsp;
     <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">'a'</span><span style="color: #008080;">;</span>
&nbsp;
     <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bizzymicbizness.com/cplusplus/representing-a-byte/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

