<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6966849264975625098</id><updated>2024-02-06T23:43:31.302-08:00</updated><category term="C++"/><category term="Microsoft Small Basic"/><category term="computer programming"/><category term="Controls"/><category term="address"/><category term="button"/><category term="else"/><category term="main function"/><category term="small basic"/><category term="variables"/><category term="ASCII"/><category term="Beginning Microsoft Small Basic"/><category term="ButtonClicked"/><category term="C"/><category term="C++ cross platform IDE"/><category term="C++ functions"/><category term="CPP"/><category term="Cplusplus"/><category term="Cprogramming web site"/><category term="Craps Game Program"/><category term="FAQ"/><category term="GraphicsWindow"/><category term="Herbert Schildt"/><category term="IF statement"/><category term="ISO C++ Standard 2011"/><category term="Introducing Small Basic"/><category term="LastButtonClicked"/><category term="Microsoft"/><category term="ShowMessage"/><category term="Slot Machine Program"/><category term="Small Basic Developers Reference Guide"/><category term="Turbo C++"/><category term="Where to get help"/><category term="Windows 7"/><category term="Windows 8.1"/><category term="arrays"/><category term="assignment statements"/><category term="case"/><category term="character"/><category term="code::blocks user manual"/><category term="comment"/><category term="compiler"/><category term="computer"/><category term="embedded systems"/><category term="event"/><category term="events"/><category term="expressions"/><category term="for"/><category term="forum"/><category term="free online compiler"/><category term="functions"/><category term="graphics window"/><category term="if"/><category term="input"/><category term="integer"/><category term="iostream"/><category term="keywords"/><category term="memory"/><category term="message"/><category term="modular programming"/><category term="multiple events"/><category term="namespace"/><category term="object oriented programming"/><category term="operators"/><category term="pointers"/><category term="print"/><category term="program"/><category term="programming"/><category term="programming kid&#39;s games"/><category term="programming language"/><category term="programming styles"/><category term="return"/><category term="sample programs"/><category term="simple addition program"/><category term="simple program"/><category term="small basic forum"/><category term="software engineer"/><category term="switch statement"/><category term="text box"/><category term="top-down programming"/><category term="tutorials"/><category term="two buttons"/><category term="well designed program"/><category term="while"/><category term="window"/><title type='text'>Programming Tutorials</title><subtitle type='html'>This blog contains tutorials on the basic principles of programming, and specific C++ programming topics.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-9191226147695262771</id><published>2014-04-10T19:02:00.004-07:00</published><updated>2014-04-10T19:02:59.497-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8.1"/><title type='text'>A Brief Introduction to Windows 8.1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Read and enjoy this brief article on Windows 8.1.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.bubblews.com/news/2905809-a-brief-introduction-to-windows-81&quot;&gt;A Brief Introduction to Windows 8.1&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/9191226147695262771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/9191226147695262771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/9191226147695262771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/9191226147695262771'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2014/04/a-brief-introduction-to-windows-81.html' title='A Brief Introduction to Windows 8.1'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-5159116040759649591</id><published>2014-03-02T20:54:00.000-08:00</published><updated>2014-03-02T20:58:49.389-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="button"/><category scheme="http://www.blogger.com/atom/ns#" term="event"/><category scheme="http://www.blogger.com/atom/ns#" term="events"/><category scheme="http://www.blogger.com/atom/ns#" term="graphics window"/><category scheme="http://www.blogger.com/atom/ns#" term="message"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="multiple events"/><category scheme="http://www.blogger.com/atom/ns#" term="program"/><category scheme="http://www.blogger.com/atom/ns#" term="text box"/><category scheme="http://www.blogger.com/atom/ns#" term="window"/><title type='text'>Microsoft Small Basic: A Simple Program Handling Multiple Events</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here is a simple Microsoft Small Basic program that handles multiple events. A graphics window is displayed with a text box and a button.&lt;br /&gt;
&lt;br /&gt;
Every time the user uses the mouse to click on the button, the message &#39;Button Clicked Event Raised&#39; is displayed in a message window. The user acknowledges the message by clicking on the &#39;OK&#39; button in the message window.&lt;br /&gt;
&lt;br /&gt;
Click the mouse in the text box window. When the user types a letter or number in the text box window, &amp;nbsp;the message &#39;Text Typed Event Raised&#39; appears in a message window. The user acknowledges the message by clicking on the &#39;OK&#39; button in the message window.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjtzlaNJo4almcAS30ndwgWVf3LEwHDaKgvx35fo9ATSKGbjycuKqQ_ljrftnizhrmvFZvEkkwrFEuqZYHEE39xf9eqKVyseoNS1gMar8xBIWofV4GTXkNj0OT2izSKwXBgftGU3q-MTUr/s1600/Handling+Multiple+Events.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjtzlaNJo4almcAS30ndwgWVf3LEwHDaKgvx35fo9ATSKGbjycuKqQ_ljrftnizhrmvFZvEkkwrFEuqZYHEE39xf9eqKVyseoNS1gMar8xBIWofV4GTXkNj0OT2izSKwXBgftGU3q-MTUr/s1600/Handling+Multiple+Events.JPG&quot; height=&quot;576&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/5159116040759649591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/5159116040759649591' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5159116040759649591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5159116040759649591'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2014/03/a-simple-program-handling-multiple.html' title='Microsoft Small Basic: A Simple Program Handling Multiple Events'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjtzlaNJo4almcAS30ndwgWVf3LEwHDaKgvx35fo9ATSKGbjycuKqQ_ljrftnizhrmvFZvEkkwrFEuqZYHEE39xf9eqKVyseoNS1gMar8xBIWofV4GTXkNj0OT2izSKwXBgftGU3q-MTUr/s72-c/Handling+Multiple+Events.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-121481886864251489</id><published>2013-01-17T09:23:00.000-08:00</published><updated>2013-01-17T09:24:34.859-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="C++ cross platform IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="code::blocks user manual"/><category scheme="http://www.blogger.com/atom/ns#" term="Cprogramming web site"/><title type='text'>Shareware: A Cross Platform C++ IDE</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I have not downloaded this C++ IDE so I can&#39;t really give any information about it. I stumbled across it while I was reading about C++11 on&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.cprogramming.com/&quot;&gt;Cprogramming Web Site&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
As of the time of this writing the C++ IDE is free.&amp;nbsp;Here is the web site where you&#39;ll find documentation and the C++ IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.codeblocks.org/&quot;&gt;Code::Blocks: A C++ IDE&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The code::blocks user manual is also available at&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.codeblocks.org/user-manual&quot;&gt;code::blocks user manual&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/121481886864251489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/121481886864251489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/121481886864251489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/121481886864251489'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2013/01/a-cross-platform-c-ide.html' title='Shareware: A Cross Platform C++ IDE'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-3088754771953340441</id><published>2013-01-14T12:11:00.001-08:00</published><updated>2013-01-14T12:12:33.068-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><category scheme="http://www.blogger.com/atom/ns#" term="modular programming"/><category scheme="http://www.blogger.com/atom/ns#" term="programming styles"/><category scheme="http://www.blogger.com/atom/ns#" term="top-down programming"/><title type='text'>Computer Programming Styles</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://scienceray.com/technology/computer-programming-styles/#.UPRla6CHQzo.blogger&quot;&gt;Computer Programming Styles&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This article discusses top-down programming and modular programming styles that I have known. Although top-down programming ans modular programming are the same, there are different styles of programming that achieve the same end.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/3088754771953340441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/3088754771953340441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/3088754771953340441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/3088754771953340441'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2013/01/computer-programming-styles.html' title='Computer Programming Styles'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-804672992768239261</id><published>2013-01-14T12:03:00.001-08:00</published><updated>2013-01-14T12:05:16.363-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><category scheme="http://www.blogger.com/atom/ns#" term="embedded systems"/><category scheme="http://www.blogger.com/atom/ns#" term="software engineer"/><category scheme="http://www.blogger.com/atom/ns#" term="well designed program"/><title type='text'>Computer Programming: The Basics of a Well Designed Program</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;a href=&quot;http://computersight.com/computers/computer-programming-the-basics-of-a-well-designed-program/#.UPRkCOSmnnA.blogger&quot;&gt;Computer Programming: The Basics of a Well Designed Program&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This article discusses all the elements of a well designed program that I learned during my 20+ years as an embedded systems software engineer.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/804672992768239261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/804672992768239261' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/804672992768239261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/804672992768239261'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2013/01/computer-programming-basics-of-well.html' title='Computer Programming: The Basics of a Well Designed Program'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-8626049788795259152</id><published>2013-01-14T11:58:00.001-08:00</published><updated>2013-01-14T12:00:18.759-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Programming with Microsoft Small Basic</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://computersight.com/programming/programming-with-microsoft-small-basic/#.UPRjDqK1QRQ.blogger&quot;&gt;Programming with Microsoft Small Basic&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/8626049788795259152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/8626049788795259152' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8626049788795259152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8626049788795259152'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2013/01/programming-with-microsoft-small-basic.html' title='Programming with Microsoft Small Basic'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-8367888691000058561</id><published>2013-01-06T17:02:00.000-08:00</published><updated>2013-01-06T17:58:21.436-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Craps Game Program"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="small basic"/><title type='text'>Small Basic: Craps Game Program With Comments</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAsoCGygG7MkzJHbpFzhIhw222GBi69-plT3-ynxD8GqZasBWw177VnIcHgNHREPWnygmqZpUxv-Cz2I2QZ-MoFLxn_p8MFRgaz06jIhg1yUNp3MJawkuQJIFiVp3OfLWjsWfSbQ20GWxD/s1600/Craps+Game+Photo.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;156&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAsoCGygG7MkzJHbpFzhIhw222GBi69-plT3-ynxD8GqZasBWw177VnIcHgNHREPWnygmqZpUxv-Cz2I2QZ-MoFLxn_p8MFRgaz06jIhg1yUNp3MJawkuQJIFiVp3OfLWjsWfSbQ20GWxD/s200/Craps+Game+Photo.JPG&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Click on photo to view it&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&#39;This is the starting point of the craps program&lt;br /&gt;
Main_Program:&lt;br /&gt;
Initialize_Craps()&lt;br /&gt;
&lt;br /&gt;
Sub Initialize_Craps&lt;br /&gt;
&amp;nbsp; &#39;Generate and size the graphics window&lt;br /&gt;
&amp;nbsp; GraphicsWindow.Show()&lt;br /&gt;
&amp;nbsp; GraphicsWindow.Height = 620&lt;br /&gt;
&amp;nbsp; GraphicsWindow.Width = 800&lt;br /&gt;
&amp;nbsp; GraphicsWindow.BackgroundColor = &quot;Cyan&quot;&lt;br /&gt;
GraphicsWindow.Title = &quot;Craps Game&quot;&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Draw the die outline for die 1&lt;br /&gt;
GraphicsWindow.DrawRectangle(100,100,180,180)&lt;br /&gt;
GraphicsWindow.BrushColor = &quot;Yellow&quot;&lt;br /&gt;
GraphicsWindow.FillRectangle(100,100,180,180)&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Draw the die outline for die 2&lt;br /&gt;
GraphicsWindow.DrawRectangle(500,100,180,180)&lt;br /&gt;
GraphicsWindow.BrushColor = &quot;Yellow&quot;&lt;br /&gt;
GraphicsWindow.FillRectangle(500,100,180,180)&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Initialize all variables for the graphics program&lt;br /&gt;
Initialize_Data()&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Draw nine &amp;nbsp;buttons in each die.&lt;br /&gt;
Draw_Buttons()&lt;br /&gt;
&#39;Create text boxes and instructions&lt;br /&gt;
GraphicsWindow.BrushColor = &quot;Black&quot;&lt;br /&gt;
&lt;br /&gt;
GraphicsWindow.DrawText(260,300,&quot;Press the left mouse button to roll the dice&quot;)&lt;br /&gt;
&#39;&lt;br /&gt;
GraphicsWindow.DrawText(280,340,&quot;Press the right mouse button exit&quot;)&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;The Instruction Box displays the messages&lt;br /&gt;
&#39;New Game&lt;br /&gt;
&#39;and&lt;br /&gt;
&#39;Roll em again&lt;br /&gt;
InstructionBox = Controls.AddTextBox(340,50)&lt;br /&gt;
Controls.SetSize(InstructionBox,100,30)&lt;br /&gt;
&lt;br /&gt;
GeneralMessageBox = Controls.AddTextBox(290,25)&lt;br /&gt;
Controls.SetSize(GeneralMessageBox,200,30)&lt;br /&gt;
Controls.SetTextBoxText(GeneralMessageBox,&quot; &amp;nbsp; Let&#39;s Play A Game Of Craps&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,400,&quot;Rules of Craps Game&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,430,&quot;First Roll of Dice&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,460,&quot;7 or 11 wins&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,490,&quot;2, 3 or 12 loses&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,520,&quot;4, 5, 6, 7, 9 or 10 okay&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,550,&quot;Matching first roll wins&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(20,580,&quot;Rolling a 7 loses&quot;)&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;The following instruction causes the execution of&lt;br /&gt;
&#39;the subroutine RollTheDice every time a mouse button&lt;br /&gt;
&#39;is pressed.&lt;br /&gt;
&#39;&lt;br /&gt;
GraphicsWindow.MouseDown = RollTheDice&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
&#39;This sub is executed every time a mouse button is pressed&lt;br /&gt;
Sub RollTheDice&lt;br /&gt;
&amp;nbsp; &#39;If the right mouse button is pressed, end the program&lt;br /&gt;
&amp;nbsp; If Mouse.IsRightButtonDown Then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Program.End()&lt;br /&gt;
&amp;nbsp; EndIf&lt;br /&gt;
&amp;nbsp; &#39;MouseEvent is used to prevent the program from responding to&lt;br /&gt;
&amp;nbsp; &#39;the mouse button being pressed again before this sub is completely executed.&lt;br /&gt;
&amp;nbsp; If MouseEvent = 0 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; MouseEvent = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Controls.SetTextBoxText(InstructionBox,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;Create two small die&lt;br /&gt;
&amp;nbsp; GraphicsWindow.BrushColor = &quot;Yellow&quot;&lt;br /&gt;
&amp;nbsp; MyDie1=Shapes.AddRectangle(50,50)&lt;br /&gt;
&amp;nbsp; Shapes.HideShape(MyDie1)&lt;br /&gt;
&amp;nbsp; Shapes.Move(MyDie1,340,170)&lt;br /&gt;
&amp;nbsp; Shapes.ShowShape(MyDie1)&lt;br /&gt;
&amp;nbsp; MyDie2=Shapes.AddRectangle(50,50)&lt;br /&gt;
&amp;nbsp; Shapes.HideShape(MyDie2)&lt;br /&gt;
&amp;nbsp; Shapes.Move(MyDie2,400,170)&lt;br /&gt;
&amp;nbsp; Shapes.ShowShape(MyDie2)&lt;br /&gt;
&amp;nbsp; talpha = 50&lt;br /&gt;
&amp;nbsp; &#39; this for loop rotates the dice&lt;br /&gt;
&amp;nbsp; For ndexa = 1 To 20&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Shapes.Rotate(MyDie1,talpha)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Shapes.ShowShape(MyDie1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Program.Delay(30)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; talpha = talpha+10&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Shapes.Rotate(MyDie2,talpha)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Shapes.ShowShape(MyDie2)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Program.Delay(30)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; talpha = talpha+10&lt;br /&gt;
&amp;nbsp; EndFor&lt;br /&gt;
&amp;nbsp; &#39;Fetch randon value for each die&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Die1_number = Math.GetRandomNumber(6)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Die2_number = Math.GetRandomNumber(6)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;Hide the dice&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Shapes.HideShape(MyDie1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Shapes.HideShape(MyDie2)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;GraphicsWindow.BrushColor = &quot;Blue&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;Display value on each die via coloring the appropriate buttons&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Display_Die_One()&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Display_Die_two()&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;Display results of first roll of dice&lt;br /&gt;
&amp;nbsp; &amp;nbsp;InfoBoxes()&lt;br /&gt;
&amp;nbsp; &amp;nbsp;MouseEvent = 0&lt;br /&gt;
&amp;nbsp;Endif&lt;br /&gt;
&amp;nbsp;EndSub&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Each die contains nine ellipses&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Here are the ellipse numbers&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; In this program ellipses are also referred&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to as buttons&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&lt;br /&gt;
&amp;nbsp;&#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&lt;br /&gt;
&amp;nbsp;&#39; &lt;br /&gt;
&amp;nbsp;Sub Display_Die_One&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;Ensure that the die only displays the results&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;of the current roll.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Reset_Die1()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; If Die1_number = 1 Then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ellipse number five is the center ellipse and&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;it&#39;s the only ellipse that is colored if the die1_number is&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;a one.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5 &#39;Select the center ellipse&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ElseIf Die1_number = 2 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;die number = 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ellipse number 1 and ellipse number 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif Die1_number = 3 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;die number = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ellipse numbers 1, 5 and 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif Die1_number = 4 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Ellipse number 1, 3, 7, and 9 are &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif die1_number = 5 then&lt;br /&gt;
&amp;nbsp; &#39;Ellipse number 1, 3, 5, 7 and 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse() &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;subcall&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif Die1_number = 6 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;subcall&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Ellipse number 1, 2, 3, 7, 8 and 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 8&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndIf&lt;br /&gt;
&amp;nbsp; EndSub&lt;br /&gt;
&amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; Sub Display_Die_Two&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;Ensure that the die only displays the results&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&#39;of the current roll.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Reset_Die2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; If Die2_number = 1 Then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ellipse number five is the center ellipse and&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;it&#39;s the only ellipse that is colored if the die2_number is&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;a one.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5 &#39;Select the center ellipse&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ElseIf Die2_number = 2 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;die number = 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ellipse number 1 and ellipse number 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif Die2_number = 3 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;die number = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;ellipse numbers 1, 5 and 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif Die2_number = 4 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;sub call&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Ellipse number 1, 3, 7, and 9 are &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif die2_number = 5 then&lt;br /&gt;
&amp;nbsp; &#39;Ellipse number 1, 3, 5, 7 and 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2() &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;subcall&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Elseif Die2_number = 6 then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;subcall&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Ellipse number 1, 2, 3, 7, 8 and 9 are colored&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 8&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ColorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EndIf&lt;br /&gt;
&amp;nbsp; EndSub&lt;br /&gt;
&amp;nbsp; &#39;&lt;br /&gt;
&amp;nbsp; Sub ColorAnEllipse&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;Color an ellipse on die 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; GraphicsWindow.BrushColor = &quot;Black&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ButtonNumber[el_num] = Shapes.AddEllipse(10,10)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Hide the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.HideShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Move the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.Move(ButtonNumber[el_num],die1_btnpos_x[el_num],die1_btnpos_y[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Show the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.ShowShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndSub&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; Sub ColorAnEllipse2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;Color an ellipse on die 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; GraphicsWindow.BrushColor = &quot;Black&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ButtonNumber[el_num] = Shapes.AddEllipse(10,10)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Hide the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.HideShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Move the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.Move(ButtonNumber[el_num],die2_btnpos_x[el_num],die2_btnpos_y[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Show the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.ShowShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndSub&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; Sub Reset_Die1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 4&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 6&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 8&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse()&lt;br /&gt;
&amp;nbsp; EndSub&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; Sub Reset_Die2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 3&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 4&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 6&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 7&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 8&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el_num = 9&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UncolorAnEllipse2()&lt;br /&gt;
&amp;nbsp; EndSub&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Sub UncolorAnEllipse&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; GraphicsWindow.BrushColor = &quot;White&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ButtonNumber[el_num] = Shapes.AddEllipse(10,10)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Hide the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.HideShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Move the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.Move(ButtonNumber[el_num],die1_btnpos_x[el_num],die1_btnpos_y[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Show the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.ShowShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp;EndSub&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Sub UncolorAnEllipse2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; GraphicsWindow.BrushColor = &quot;White&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ButtonNumber[el_num] = Shapes.AddEllipse(10,10)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Hide the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.HideShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Move the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.Move(ButtonNumber[el_num],die2_btnpos_x[el_num],die2_btnpos_y[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Show the button&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Shapes.ShowShape(ButtonNumber[el_num])&lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndSub&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;Sub Initialize_Data&lt;br /&gt;
&#39;Initialize all variables used in the program&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Generate buttom positions on die 1&lt;br /&gt;
die1_btnpos_x[1] = 120&lt;br /&gt;
die1_btnpos_x[2] = 120&lt;br /&gt;
die1_btnpos_x[3] = 120&lt;br /&gt;
die1_btnpos_x[4] = 185&lt;br /&gt;
die1_btnpos_x[5] = 185&lt;br /&gt;
die1_btnpos_x[6] = 185&lt;br /&gt;
die1_btnpos_x[7] = 250&lt;br /&gt;
die1_btnpos_x[8] = 250&lt;br /&gt;
die1_btnpos_x[9] = 250&lt;br /&gt;
&#39;&lt;br /&gt;
die1_btnpos_y[1] = 120&lt;br /&gt;
die1_btnpos_y[2] = 185&lt;br /&gt;
die1_btnpos_y[3] = 250&lt;br /&gt;
die1_btnpos_y[4] = 120&lt;br /&gt;
die1_btnpos_y[5] = 185&lt;br /&gt;
die1_btnpos_y[6] = 250&lt;br /&gt;
die1_btnpos_y[7] = 120&lt;br /&gt;
die1_btnpos_y[8] = 185&lt;br /&gt;
die1_btnpos_y[9] = 250&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Generate die 2 button positions&lt;br /&gt;
displacement = 400&lt;br /&gt;
For ndex = 1 to 9&lt;br /&gt;
die2_btnpos_x[ndex] = die1_btnpos_x[ndex] + displacement&lt;br /&gt;
die2_btnpos_y[ndex] = die1_btnpos_y[ndex]&lt;br /&gt;
EndFor&lt;br /&gt;
&lt;br /&gt;
ButtonSize_x = 10&lt;br /&gt;
ButtonSize_y = 10&lt;br /&gt;
&lt;br /&gt;
&#39; This flag indicates the first roll of&lt;br /&gt;
&#39;the dice in a game of craps&lt;br /&gt;
First_Dice_Roll = 1&lt;br /&gt;
First_Die1_Roll_no = 0&lt;br /&gt;
First_Die2_Roll_no = 0&lt;br /&gt;
&#39; MouseEvent prevents a mouse down event from&lt;br /&gt;
&#39;being serviced while a previous mouse down event&lt;br /&gt;
&#39;is being serviced.&lt;br /&gt;
&#39;Intialize MouseEvent to zero to indicate that&lt;br /&gt;
&#39;no mouse event is being serviced&lt;br /&gt;
MouseEvent = 0&lt;br /&gt;
InitializeMsgData()&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub InitializeMsgData&lt;br /&gt;
&amp;nbsp; &#39;Initializes the data for mytextbox1 and mytextbox2&lt;br /&gt;
&amp;nbsp; &#39;which are used to display the results&lt;br /&gt;
&amp;nbsp; &#39;of the first dice roll&lt;br /&gt;
yposText = 500&lt;br /&gt;
xposText1 = 250&lt;br /&gt;
xposText2 = 450&lt;br /&gt;
xposDie1 = 320&lt;br /&gt;
xposDie2 = 520&lt;br /&gt;
yposDie = 500&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub InfoBoxes&lt;br /&gt;
&amp;nbsp; &#39;This sub displays the first roll of the dice&lt;br /&gt;
&amp;nbsp; If First_Dice_Roll = 1 Then&lt;br /&gt;
GraphicsWindow.DrawText(xposText1+100,yposText-30, &quot;First Roll of Dice&quot;)&lt;br /&gt;
GraphicsWindow.DrawText(xposText1,yposText,&quot;Die One &quot;)&lt;br /&gt;
mytextbox1 = Controls.AddTextBox(xposDie1,yposDie)&lt;br /&gt;
Controls.SetSize(mytextbox1,40,20)&lt;br /&gt;
Controls.SetTextBoxText(mytextbox1,Die1_Number)&lt;br /&gt;
GraphicsWindow.DrawText(xposText2,yposText,&quot;Die Two &quot;)&lt;br /&gt;
mytextbox2 = Controls.AddTextBox(xposDie2,yposDie)&lt;br /&gt;
Controls.SetSize(mytextbox2,40,20)&lt;br /&gt;
Controls.SetTextBoxText(mytextbox2,Die2_Number)&lt;br /&gt;
First_Die1_Roll_no = Die1_number&lt;br /&gt;
First_Die2_Roll_no = Die2_number&lt;br /&gt;
Die1_number = 0&lt;br /&gt;
Die2_number = 0&lt;br /&gt;
First_Dice_Roll = 0&lt;br /&gt;
EndIf&lt;br /&gt;
&#39;Controls.SetTextBoxText(mytextbox,myvalue) &#39;overwrites previous value&lt;br /&gt;
DetermineWinOrLoss()&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
&#39;&lt;br /&gt;
Sub Draw_Buttons&lt;br /&gt;
&amp;nbsp; &#39;-------------------------------------------&lt;br /&gt;
&#39;Software to draw nine buttons on die_1&lt;br /&gt;
&#39; and nine buttons on die-2&lt;br /&gt;
&#39;Left column Button one Top&lt;br /&gt;
&#39;&lt;br /&gt;
&#39;Create the buttons&lt;br /&gt;
For i = 1 to 9&lt;br /&gt;
GraphicsWindow.BrushColor = &quot;White&quot;&lt;br /&gt;
ButtonNumber[i] = Shapes.AddEllipse(10,10)&lt;br /&gt;
&#39;Hide the button&lt;br /&gt;
Shapes.HideShape(ButtonNumber[i])&lt;br /&gt;
&#39;Move the button&lt;br /&gt;
Shapes.Move(ButtonNumber[i],die1_btnpos_x[i],die1_btnpos_y[i])&lt;br /&gt;
&#39;Show the button&lt;br /&gt;
Shapes.ShowShape(ButtonNumber[i])&lt;br /&gt;
GraphicsWindow.BrushColor = &quot;White&quot;&lt;br /&gt;
ButtonNumber[i] = Shapes.AddEllipse(10,10)&lt;br /&gt;
&#39;Hide the button&lt;br /&gt;
Shapes.HideShape(ButtonNumber[i])&lt;br /&gt;
&#39;Move the button&lt;br /&gt;
Shapes.Move(ButtonNumber[i],die2_btnpos_x[i],die2_btnpos_y[i])&lt;br /&gt;
&#39;Show the button&lt;br /&gt;
Shapes.ShowShape(ButtonNumber[i])&lt;br /&gt;
EndFor&lt;br /&gt;
EndSub&lt;br /&gt;
&#39;&lt;br /&gt;
Sub DetermineWinOrLoss&lt;br /&gt;
First_Dice_Total = First_Die1_Roll_no + First_Die2_Roll_no&lt;br /&gt;
&amp;nbsp; Current_Dice_Total = Die1_number + Die2_number&lt;br /&gt;
If First_Dice_Total = 7 Then&lt;br /&gt;
&amp;nbsp; YouWin()&lt;br /&gt;
ElseIf First_Dice_Total = 11 Then&lt;br /&gt;
&amp;nbsp; YouWin()&lt;br /&gt;
ElseIf First_Dice_Total = 2 Then&lt;br /&gt;
&amp;nbsp; YouLose()&lt;br /&gt;
ElseIf First_Dice_Total = 3 Then&lt;br /&gt;
&amp;nbsp; YouLose()&lt;br /&gt;
ElseIf First_Dice_Total = 12 Then&lt;br /&gt;
&amp;nbsp; YouLose()&lt;br /&gt;
ElseIf Current_Dice_Total = First_Dice_Total Then &lt;br /&gt;
&amp;nbsp; YouWin()&lt;br /&gt;
Elseif Current_Dice_Total = 7 then&lt;br /&gt;
&amp;nbsp; YouLose()&lt;br /&gt;
Else&lt;br /&gt;
Controls.SetTextBoxText(InstructionBox,&quot;Roll &#39;em again!&quot;) &lt;br /&gt;
Endif&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub YouWin&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(InstructionBox,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; Sound.PlayChime()&lt;br /&gt;
&amp;nbsp; GraphicsWindow.ShowMessage(&quot;You Win!&quot;,&quot;Craps&quot;)&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(mytextbox1,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(mytextbox2,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; First_Dice_Roll = 1&lt;br /&gt;
&amp;nbsp; First_Die1_Roll_no = 0&lt;br /&gt;
&amp;nbsp; First_Die2_Roll_no = 0&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(InstructionBox,&quot; &amp;nbsp;New game!&quot;)&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub YouLose&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(InstructionBox,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; Sound.PlayBellRing()&lt;br /&gt;
&amp;nbsp; GraphicsWindow.ShowMessage(&quot;Dang it! You lose&quot;,&quot;Craps&quot;)&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(mytextbox1,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(mytextbox2,&quot; &quot;)&lt;br /&gt;
&amp;nbsp; First_Dice_Roll = 1&lt;br /&gt;
&amp;nbsp; First_Die1_Roll_no = 0&lt;br /&gt;
&amp;nbsp; First_Die2_Roll_no = 0&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(InstructionBox,&quot; &amp;nbsp;New game!&quot;)&lt;br /&gt;
EndSub&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/8367888691000058561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/8367888691000058561' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8367888691000058561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8367888691000058561'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2013/01/small-basic-craps-game-program-with.html' title='Small Basic: Craps Game Program With Comments'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAsoCGygG7MkzJHbpFzhIhw222GBi69-plT3-ynxD8GqZasBWw177VnIcHgNHREPWnygmqZpUxv-Cz2I2QZ-MoFLxn_p8MFRgaz06jIhg1yUNp3MJawkuQJIFiVp3OfLWjsWfSbQ20GWxD/s72-c/Craps+Game+Photo.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-5286096473972909779</id><published>2012-12-11T23:58:00.001-08:00</published><updated>2012-12-11T23:58:49.059-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="forum"/><category scheme="http://www.blogger.com/atom/ns#" term="free online compiler"/><category scheme="http://www.blogger.com/atom/ns#" term="sample programs"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorials"/><title type='text'>A Free On-Line C/C++ Compiler </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
For those who like programming in C or C++, this is a site where you can register for free and use their compiler. You can also view tutorials and sample programs. This site also has a forum.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.botskool.com/&quot;&gt;BotSkool: C and C++ Free On Line Compiler&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/5286096473972909779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/5286096473972909779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5286096473972909779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5286096473972909779'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/12/a-free-on-line-cc-compiler.html' title='A Free On-Line C/C++ Compiler '/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-3367289008578623024</id><published>2012-12-02T21:06:00.000-08:00</published><updated>2012-12-03T22:02:32.940-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Slot Machine Program"/><title type='text'>Microsoft Small Basic: A Very Simple Slot Machine Program</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;i&gt;Here is a simple slot machine program that uses text boxes to display the three numbers. It also uses the timer command.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&#39;Create a very simple slot machine game&lt;br /&gt;
GraphicsWindow.Show()&lt;br /&gt;
GraphicsWindow.Title = &quot;A Very Simple Slot Machine Game&quot;&lt;br /&gt;
&#39;Add Text Boxes&lt;br /&gt;
TextBoxOne = Controls.AddTextBox(30,30)&lt;br /&gt;
TextBoxTwo = Controls.AddTextBox(30,70)&lt;br /&gt;
TextBoxThree = Controls.AddTextBox(30,110)&lt;br /&gt;
&#39;Add Button for rolling them&lt;br /&gt;
RollButton= Controls.AddButton(&quot;Roll &#39;em&quot;,30,150)&lt;br /&gt;
&#39;Display the word Blank in each text bos&lt;br /&gt;
Controls.SetTextBoxText(TextBoxOne,&quot;Blank&quot;)&lt;br /&gt;
Controls.SetTextBoxText(TextBoxTwo,&quot;Blank&quot;)&lt;br /&gt;
Controls.SetTextBoxText(TextBoxThree,&quot;Blank&quot;)&lt;br /&gt;
&#39;When Button is pressed, call RollEmSub&lt;br /&gt;
Controls.ButtonClicked = RollEmSub&lt;br /&gt;
&lt;br /&gt;
Sub RollEmSub&lt;br /&gt;
&amp;nbsp; &#39;Generate random number between 1 and 3 for each text box&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(TextBoxOne, Math.GetRandomNumber(3))&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(TextBoxTwo, Math.GetRandomNumber(3))&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(TextBoxThree, Math.GetRandomNumber(3))&lt;br /&gt;
&amp;nbsp; &#39;Read each random number&lt;br /&gt;
&amp;nbsp; TextOne = Controls.GetTextBoxText(TextBoxOne)&lt;br /&gt;
&amp;nbsp; TextTwo = Controls.GetTextBoxText(TextBoxTwo)&lt;br /&gt;
&amp;nbsp; TextThree = Controls.GetTextBoxText(TextBoxThree)&lt;br /&gt;
&amp;nbsp; &#39;Compare random numbers&lt;br /&gt;
&amp;nbsp; If TextOne = TextTwo Then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; If TextTwo = TextThree Then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Display You Win&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Controls.SetButtonCaption(RollButton,&quot;You Win!&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Controls.ButtonClicked = DoNothingSub&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;Set delay timer for 20 seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Timer.Interval = 2000&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;When timer expires call EndDelaySub&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Timer.Tick = EndDelaySub&lt;br /&gt;
&amp;nbsp; &amp;nbsp;EndIf&lt;br /&gt;
&amp;nbsp;EndIf&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub EndDelaySub&lt;br /&gt;
&amp;nbsp; Controls.SetButtonCaption(RollButton,&quot;Game over!&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&#39;Set delay timer for 20 seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Timer.Interval = 2000&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;When timer expires call EndProgramSub&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Timer.Tick = EndProgramSub&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub DoNothingSub&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
Sub EndProgramSub&lt;br /&gt;
&amp;nbsp; Program.End()&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/3367289008578623024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/3367289008578623024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/3367289008578623024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/3367289008578623024'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/12/a-very-simple-slot-machine-program.html' title='Microsoft Small Basic: A Very Simple Slot Machine Program'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-5782728912131218333</id><published>2012-12-01T21:02:00.000-08:00</published><updated>2012-12-06T23:00:25.706-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="FAQ"/><category scheme="http://www.blogger.com/atom/ns#" term="ISO C++ Standard 2011"/><title type='text'>ISO C++ Standard 2011</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
A new ISO Standard for C++ was issued in 2011 and has been implemented in the latest C++ compilers. &amp;nbsp;I searched for an explanation of this standard after trying to compile a short C++ program that used&lt;br /&gt;
a structure containing a character string.&lt;br /&gt;
&lt;br /&gt;
The compiler reported an error for both these statements:&lt;br /&gt;
char* mystring = &quot;John&quot;;&lt;br /&gt;
string mystring = &quot;John&quot;;&lt;br /&gt;
The error stated that ISO prohibited the initiation of a constant string.&lt;br /&gt;
&lt;br /&gt;
There are still a lot of C++ books and a lot of C++ tutorials that implement this old style of initiating strings. &amp;nbsp;And this is fine for people working with old compilers. However people working with new compilers or free on-line compilers will experience difficulties with the two C++ statements above as well as in other C++ statements.&lt;br /&gt;
&lt;br /&gt;
I found a C++11 on-line reference at&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://en.cppreference.com/w/&quot;&gt;C++11 Reference&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The ISO 2011 C++ Standard costs about $30.00 to download. So I searched further and found a ISO 2011 C++ FAQ for which I provide the link below:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.stroustrup.com/C++11FAQ.html&quot;&gt;C++11 - the new ISO C++ standard&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/5782728912131218333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/5782728912131218333' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5782728912131218333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5782728912131218333'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/12/iso-c-standard-2011.html' title='ISO C++ Standard 2011'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-5633255989143708461</id><published>2012-09-27T02:53:00.000-07:00</published><updated>2012-09-27T03:00:45.198-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="button"/><category scheme="http://www.blogger.com/atom/ns#" term="Controls"/><category scheme="http://www.blogger.com/atom/ns#" term="simple addition program"/><category scheme="http://www.blogger.com/atom/ns#" term="small basic"/><title type='text'>Small Basic: A Simple Addition Program</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here is a simple Microsoft Small Basic Program that adds two numbers and displays the answer.&lt;br /&gt;
&lt;br /&gt;
&#39;Create a Graphics Window&lt;br /&gt;
GraphicsWindow.Show()&lt;br /&gt;
&#39;Create caption and text box for the first variable&lt;br /&gt;
GraphicsWindow.DrawText(20,20,&quot;Enter First Number&quot;)&lt;br /&gt;
typedvar1 = Controls.AddTextBox(200,20)&lt;br /&gt;
&#39;Create caption and text box for the second variable&lt;br /&gt;
GraphicsWindow.DrawText(20,120,&quot;Enter Second Number&quot;)&lt;br /&gt;
typedvar2 = Controls.AddTextBox(200,120)&lt;br /&gt;
&#39;Create caption and text box for the answer&lt;br /&gt;
GraphicsWindow.DrawText(20,220,&quot;The answer is&quot;)&lt;br /&gt;
Answer1 = Controls.AddTextBox(200,220)&lt;br /&gt;
&#39;Create a button for adding the two variables&lt;br /&gt;
Controls.AddButton(&quot;Add&quot;, 220,400)&lt;br /&gt;
&#39;The answer goes in textbox labeled Answer1&lt;br /&gt;
Controls.SetTextBoxText(Answer1, &quot; &amp;nbsp;&quot;)&lt;br /&gt;
&#39;Execute subroutine named buttonsub when add button is clicked&lt;br /&gt;
Controls.ButtonClicked = buttonsub&lt;br /&gt;
&#39;Subroutine executed when add button is clicked&lt;br /&gt;
Sub buttonsub&lt;br /&gt;
&amp;nbsp; &#39;fetch two numbers entered&lt;br /&gt;
&amp;nbsp; var1 = Controls.GetTextBoxText(typedvar1)&lt;br /&gt;
&amp;nbsp; var2 = Controls.GetTextBoxText(typedvar2)&lt;br /&gt;
&amp;nbsp; &#39;Add the two numbers&lt;br /&gt;
&amp;nbsp; var3 = var1 + var2&lt;br /&gt;
&amp;nbsp; &#39;Display the sum in the textbox named answer1&lt;br /&gt;
&amp;nbsp; Controls.SetTextBoxText(Answer1,var3)&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/5633255989143708461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/5633255989143708461' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5633255989143708461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5633255989143708461'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/09/small-basic-simple-addition-program.html' title='Small Basic: A Simple Addition Program'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-8824188084867501580</id><published>2012-08-28T13:29:00.000-07:00</published><updated>2012-09-29T10:41:28.903-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ButtonClicked"/><category scheme="http://www.blogger.com/atom/ns#" term="Controls"/><category scheme="http://www.blogger.com/atom/ns#" term="GraphicsWindow"/><category scheme="http://www.blogger.com/atom/ns#" term="LastButtonClicked"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="ShowMessage"/><category scheme="http://www.blogger.com/atom/ns#" term="simple program"/><category scheme="http://www.blogger.com/atom/ns#" term="two buttons"/><title type='text'>Microsoft Small Basic: A Simple Program With Two Buttons</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;i&gt;Here is a simple Small Basic program that uses two buttons. When a button is pressed, a window message pops up naming the button that was pressed.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GraphicsWindow.Show()&lt;br /&gt;
&#39;Add the button labeled Exit&lt;br /&gt;
ExitButton = Controls.AddButton(&quot;Exit&quot;,20,50)&lt;br /&gt;
&#39;Add the button labeled Hello&lt;br /&gt;
HelloButton = Controls.AddButton(&quot;Hello&quot;,20,20)&lt;br /&gt;
&#39;When a button is clicked, call the ButtonsBeenClicked subroutine&lt;br /&gt;
Controls.ButtonClicked=ButtonsBeenClicked&lt;br /&gt;
&lt;br /&gt;
Sub ButtonsBeenClicked&lt;br /&gt;
&amp;nbsp; &#39;If the Hello button was clicked, display the message Hello Button Presssed&lt;br /&gt;
&amp;nbsp; If controls.LastClickedButton = HelloButton then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; GraphicsWindow.ShowMessage(&quot;Hello Button Pressed&quot;,&quot;Button Message&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &#39;Else if the Exit button was clicked, display the message Exit Button Pressed&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ElseIf controls.LastClickedButton = ExitButton then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; GraphicsWindow.ShowMessage(&quot;Exit Button Pressed&quot;,&quot;Button Message&quot;)&lt;br /&gt;
&amp;nbsp; EndIf&lt;br /&gt;
EndSub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/8824188084867501580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/8824188084867501580' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8824188084867501580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8824188084867501580'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/08/microsoft-small-basic-simple-program.html' title='Microsoft Small Basic: A Simple Program With Two Buttons'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-2760742021252094932</id><published>2012-08-24T02:09:00.000-07:00</published><updated>2012-09-29T13:07:42.648-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="programming kid&#39;s games"/><category scheme="http://www.blogger.com/atom/ns#" term="small basic forum"/><category scheme="http://www.blogger.com/atom/ns#" term="Where to get help"/><title type='text'>Microsoft Small Basic: Where To Get Help</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
After downloading and installing Microsoft Small Basic and the free tutorial Introducing Small Basic, the next logical question is: &quot;Okay. If I need help, where do I go?&quot;&lt;br /&gt;
&lt;br /&gt;
Of course, the first place I turned to was the Microsoft Small Basic Forum at MSDN&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en-US/smallbasic/&quot;&gt;MSDN Small Basic Forum&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Another place to get help is&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://smallbasic.com/&quot;&gt;Small Basic Web Site&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If your primary goal is creating kid&#39;s games than this book might be very helpful&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.computerscienceforkids.com/Pages/ProgrammingKidGameswithMicrosoftSmallBasicTutorial.aspx&quot;&gt;Programming Kid&#39;s Games With Microsoft Small Basic&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/2760742021252094932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/2760742021252094932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2760742021252094932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2760742021252094932'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/08/microsoft-small-basic-where-to-get-help.html' title='Microsoft Small Basic: Where To Get Help'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-367546911136560359</id><published>2012-08-23T19:49:00.000-07:00</published><updated>2012-08-23T19:49:18.129-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Beginning Microsoft Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="Introducing Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Small Basic"/><category scheme="http://www.blogger.com/atom/ns#" term="Small Basic Developers Reference Guide"/><title type='text'>Microsoft Small Basic: A Graphical Programming Language For Beginners</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I&#39;ve been tinkering with Microsoft Small Basic over the past several months. At the time of this writing, Microsoft Small Basic is available for free at the URL listed below. &amp;nbsp;Microsoft Small Basic is intended for beginners. The free tutorial is titled Introducing Small Basic and it is relatively easy to read and follow. &lt;br /&gt;
&lt;br /&gt;
The editor is easy to use and the programmer is guided step by step through each program line the programmer types in. I like it very much.&lt;br /&gt;
&lt;br /&gt;
I also purchased a book titled &#39;The Developer&#39;s Reference Guide to Microsoft Small Basic.&#39; &amp;nbsp;This reference guide is actually a tutorial for anyone familiar with programming. It is a reference guide for beginners. And, thus far, it has been helpful. Unlike Visual Basic, Small Basic does not have the drag and drop feature for adding text boxes, buttons and drop down menus to a program. It is an object oriented graphics programming language, but the explanation is simple enough so that the programmer unfamiliar with object oriented programming can understand it.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll write more about Microsoft Small Basic as I explore it. Right now, I recommend it for anyone who wants to learn how to program.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/beginner/ff384126.aspx&quot;&gt;Download Microsoft Small Basic Here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Look around for the Microsoft Small Basic Reference Guide. I was able to find one selling for $19.99 at Amazon. Here is a URL where you can purchase the Reference book. Unfortunately, the lower priced one is no longer listed.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/Developers-Reference-Guide-Microsoft-Small/dp/1937161242/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1345775277&amp;amp;sr=1-1&amp;amp;keywords=Microsoft+Small+Basic&quot;&gt;Microsoft Small Basic Developers Reference Guide&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the URL for another Microsoft Small Basic Book:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.com/Beginning-Microsoft-Small-Philip-Conrod/dp/1937161196/ref=sr_1_2?s=books&amp;amp;ie=UTF8&amp;amp;qid=1345775918&amp;amp;sr=1-2&amp;amp;keywords=Microsoft+Small+Basic+Books&quot;&gt;Beginning Microsoft Small Basic&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/367546911136560359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/367546911136560359' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/367546911136560359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/367546911136560359'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/08/microsoft-small-basic-graphical.html' title='Microsoft Small Basic: A Graphical Programming Language For Beginners'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-2879732034276486216</id><published>2012-06-23T00:18:00.000-07:00</published><updated>2012-06-23T00:19:33.806-07:00</updated><title type='text'>Book Review: Pointers on C</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The book &#39;Pointers on C&#39; is an excellent book for the person with a working knowledge of the C language. If the reader does not know this, the reader will be made painfully aware of it in the first chapter. &amp;nbsp;Instead of the typical &quot;Hello World&quot; one line program, the program explained in the first chapter is one only a person who has written programs would understand. In the explanation of the program and throughout the rest of the book, the author sites good and bad programming practices. This is exactly why I like this book. It covers C programming in a unique way.&lt;br /&gt;
&lt;br /&gt;
In the second chapter, the author discusses lexical rules and the importance of good program style. Each chapter is devoted to one topic: Data, Statements, Operators and Expression, Pointers, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;As the reader probably guess, the book elaborates on pointers. &amp;nbsp;There are three chapters focused on pointers and chapters with partial focus on pointers. These chapters include the chapters titled Arrays, Using Structures and Pointers and Advanced Pointer Topics as well as many other chapters.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;The book also contains a chapter on the Preprocessor, abstract data types and the run-time environment.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;This book is a practical book on the C language. I&#39;ve had this book for years and have referenced it while I was an embedded systems software engineer.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Pointers on C&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Written by Kenneth A. Reek&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Published by Addison-Wesley&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;ISBN 0-673-99986-6&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/2879732034276486216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/2879732034276486216' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2879732034276486216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2879732034276486216'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/06/book-review-pointers-on-c.html' title='Book Review: Pointers on C'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-2462765454634391368</id><published>2012-06-19T19:40:00.000-07:00</published><updated>2012-06-19T19:40:42.093-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="CPP"/><category scheme="http://www.blogger.com/atom/ns#" term="Herbert Schildt"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Turbo C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows 7"/><title type='text'>Object Oriented Programming With Turbo C++</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The book Object Oriented Programming With Turbo C++ has received mixed reviews on the Internet. This book is not a tutorial on C++. The book explains and provides the code for Object Oriented Programming applications.&lt;br /&gt;
&lt;br /&gt;
After a brief introduction to Object Oriented Programming, the book explains and presents two versions of a File Browser Program. The first version does not use Object Oriented Programming. The second version uses Object Oriented Programming.&lt;br /&gt;
&lt;br /&gt;
The book can be very confusing if the reader tries to read it like a text book. Reading it does not suffice. As the reader reads it, the reader should create an index of functions, classes, data and the pages they are on.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The disadvantage is that the program was written in Turbo C++ 1.0. &amp;nbsp;However, there is a free version of Turbo C++ that works on Windows ME, Windows 2000, Windows XP, Windows 7 and Windows NT.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
You can download it at the following site:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://turbo-c.soft32.com/&quot;&gt;http://turbo-c.soft32.com/&lt;/a&gt;
&lt;/div&gt;
&lt;span style=&quot;background-color: #ebe9e1; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
In addition, there is a book&lt;br /&gt;
Turbo C++: The Complete Reference&lt;br /&gt;
written by Herbert Schildt&lt;br /&gt;
available on the Internet.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;I am not affiliated in any way with the web sites and the author or publisher of the Turbo C++ books presented in this blog.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/2462765454634391368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/2462765454634391368' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2462765454634391368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2462765454634391368'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/06/object-oriented-programming-with-turbo.html' title='Object Oriented Programming With Turbo C++'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-8435217627462534563</id><published>2012-01-22T03:17:00.000-08:00</published><updated>2012-01-22T03:17:45.635-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++ functions"/><category scheme="http://www.blogger.com/atom/ns#" term="functions"/><category scheme="http://www.blogger.com/atom/ns#" term="integer"/><category scheme="http://www.blogger.com/atom/ns#" term="main function"/><category scheme="http://www.blogger.com/atom/ns#" term="return"/><category scheme="http://www.blogger.com/atom/ns#" term="variables"/><title type='text'>Introduction to C++ Functions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
This blog assumes that the reader understand how to create a C++ program containing a single statement that displays the phrase &quot;Hello World!&quot; Therefore this blog focuses solely on functions and does not explain the main function nor the class libraries.&lt;br /&gt;
&lt;br /&gt;
A function is a group of C++ statements that collectively perform a specific well defined task. Functions can be executed repeatedly throughout a program. The advantage of a function is that the programmer does not have to repeat the C++ statements each time the task needs to be performed.&lt;br /&gt;
&lt;br /&gt;
First, I will explain each statement in the example, then I will present the complete tested and debugged example.&lt;br /&gt;
&lt;br /&gt;
/* The first statement lists the iostream class. */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* The second statement invokes namespace. */&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
/* For more details on iostream and namespace see my blog titled&lt;br /&gt;
An Introduction to C++ Programming. */&lt;br /&gt;
&lt;br /&gt;
/* Now we can insert our function header. You can name your function any name you like. I recommend that the function name describes what the function does. This will make it easier to understand the program when you come back to modify it. The word void at the far left of the function name means that the function does not return anything to the calling function. In this example, the calling function is the main function. The word void in the parenthesis means nothing is passed to the function from the main function. */&lt;br /&gt;
&lt;br /&gt;
void Display_Hello_World(void)&lt;br /&gt;
&lt;br /&gt;
/* The beginning of the function is defined by an opening curly bracket. */&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
/* The function only has one statement. That statement displays the words &quot;Hello World&quot; on the monitor. The cout function is defined in the iostream class library. */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Hello World!&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
/* The end of the function is defined by a closing curly bracket. */&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* The main function invokes the function name Display_Hello_World. */&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
{&lt;br /&gt;
Display_Hello_World();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* A function can return a value. The following function declares an integer, assigns a value to that integer and returns the integer value to the calling function. */&lt;br /&gt;
&lt;br /&gt;
int FReturn_A_Value (void)&lt;br /&gt;
{&lt;br /&gt;
int a_value = 5;&lt;br /&gt;
return a_value;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* The main function calls the FReturn_A_Value funtion and &amp;nbsp;and stores the value returned in my_value. */&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
{&lt;br /&gt;
int my_value;&lt;br /&gt;
my_value = FReturn_A_Value();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* A variable can be passed to a function. The function FPass_A_Variable accepts an integer from the main function and displays it. */&lt;br /&gt;
&lt;br /&gt;
void FPass_A_Variable(int my_value)&lt;br /&gt;
{&lt;br /&gt;
cout &amp;lt;&amp;lt; my_value &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* The main funtion declares an integer, assigns the integer the value of 5 and passes the value to the function FPass_A_Variable. */&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
{&lt;br /&gt;
int value = 5;&lt;br /&gt;
FPass_A_Variable(value);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
We can implement each defined task in a function. The function makes the program easier to read and easier to troubleshoot. The name of the function should describe what the function does. Likewise, the name of the variables should describe those variables. We know that the variable is an integer. The variable name should describe what the variable is.&lt;br /&gt;
&lt;br /&gt;
An example is:&lt;br /&gt;
int temperature;&lt;br /&gt;
&lt;br /&gt;
Here are examplies of function names&lt;br /&gt;
Read_Temperature().&lt;br /&gt;
Test_temperature_range().&lt;br /&gt;
Display_temperature().&lt;br /&gt;
Display_warning_message().&lt;br /&gt;
&lt;br /&gt;
Note how easy it is to understand each function does.&lt;br /&gt;
The more clearly one describes variables and functions, the easier it is to read and understand the program.&lt;br /&gt;
The function should execute a single well defined task. The inputs and outputs of each function could be defined in the comments before the actual function.&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************&lt;br /&gt;
Function name&lt;br /&gt;
Inputs: Description of each input&lt;br /&gt;
Outputs: Describe the each output&lt;br /&gt;
Description: Describes what the function does&lt;br /&gt;
*********************************************************************/&lt;br /&gt;
/* Place function here */&lt;br /&gt;
&lt;br /&gt;
The advantage of these comments is the time it saves if the programmer should have to modify the program months or years after the program was designed.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/8435217627462534563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/8435217627462534563' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8435217627462534563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/8435217627462534563'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/introduction-to-c-functions.html' title='Introduction to C++ Functions'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-7464330400647524651</id><published>2012-01-13T02:27:00.000-08:00</published><updated>2012-01-13T02:27:41.864-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="compiler"/><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><title type='text'>Basic Concepts of Computer Programming</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
　&lt;br /&gt;

&lt;br /&gt;
I originally published this article on Yahoo Voices under the pen name John Mario.&lt;br /&gt;

&lt;br /&gt;
This article is intended for those who have not had any exposure to computer programming and have no knowledge of electronics. This article does not define how to write a program in a specific language. It only covers the basics.&lt;br /&gt;

&lt;br /&gt;
In order to write a computer program, you need a compiler. A compiler allows you to use a specific set of instructions to create a computer program and then convert that program into machine language.&lt;br /&gt;

&lt;br /&gt;
Each compiler is for a specific programming language. A programming language is a specific set of instructions available for use in any program. Two very popular programming languages are Visual Basic and Visual C++. The modern compilers provide the user with an editor that allows the user to type in the program. You would type selected instructions in a specific order to perform a specific task. For example, you might want to collect information from the user and display that information on the monitor.&lt;br /&gt;

&lt;br /&gt;
One instruction found in compilers is the print instruction.&lt;br /&gt;

&lt;br /&gt;
If you wrote a program to display the phrase &quot;Hello World,&quot; you would use the print instruction.&lt;br /&gt;

&lt;br /&gt;
It would look like this:&lt;br /&gt;

&lt;br /&gt;
print &quot;Hello World!&quot;&lt;br /&gt;

&lt;br /&gt;
Each compiler may require a different syntax for the print instruction. For example: the C++ compiler requires a semicolon at the end of each instruction. Hence in C++ you would type&lt;br /&gt;

&lt;br /&gt;
print &quot;Hello World!&quot;;&lt;br /&gt;

&lt;br /&gt;
There are other requirements for a complete C++ program to print &quot;Hello World.&quot; But the exact contents of the complete program in C++ is beyond the scope of this article.&lt;br /&gt;

&lt;br /&gt;
After writing and saving your program, you have to build your program. Building a program means converting the program to machine language. The resulting machine language file contains binary codes. When you build a program, the program may list syntax errors. These errors are instructions that are typed in wrong. They may be missing punctuation marks or they may contain unrecognized words.&lt;br /&gt;

&lt;br /&gt;
When you execute the program, the binary code is converted into voltage levels that are applied to the electronics inside your computer to cause the computer to perform a specific action.&lt;br /&gt;

&lt;br /&gt;
After you build the program, you have to test it. You start by executing the program. If the program does not run correctly, you have to examine the program to find out what is wrong. Debugging a program is an art by itself.&lt;br /&gt;

&lt;br /&gt;
Learning programming is a challenging task that will consume a significant portion of your time. I highly recommend taking a course in school. However, if you prefer to learn on your own, you might join a programmer&#39;s forum on the web.Then you can ask questions in the forum about which is the best compiler for you and which books they recommend. Your best bet is to go to your local book store where you can read a few pages of the book to find out if you can understand it. &lt;br /&gt;

&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span lang=&quot;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;Reference:&lt;br /&gt;

&lt;br /&gt;
My experience as an embedded systems software engineer.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/7464330400647524651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/7464330400647524651' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/7464330400647524651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/7464330400647524651'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/basic-concepts-of-computer-programming.html' title='Basic Concepts of Computer Programming'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-6642865261381375876</id><published>2012-01-13T01:50:00.000-08:00</published><updated>2012-01-13T02:09:01.243-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="address"/><category scheme="http://www.blogger.com/atom/ns#" term="arrays"/><category scheme="http://www.blogger.com/atom/ns#" term="ASCII"/><category scheme="http://www.blogger.com/atom/ns#" term="character"/><category scheme="http://www.blogger.com/atom/ns#" term="Cplusplus"/><category scheme="http://www.blogger.com/atom/ns#" term="pointers"/><title type='text'>Cplusplus: Understanding Arrays, Character Strings, and Pointers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
I originally published this article on Yahoo Voices under the pen name John Mario.&lt;br /&gt;
&lt;br /&gt;
We learned in earlier lessons that a variable is the name of a memory location that holds data. In computers, we also need a way to find that memory location. In real life, the US Post Office finds our residences via our address. Each memory location in a computer is assigned a numeric address.&lt;br /&gt;
&lt;br /&gt;
Before we learn about pointers, arrays and strings, let&#39;s become familiar with the American Standard Code for Information Interchange (ASCII).&lt;br /&gt;
&lt;br /&gt;
The ASCII code is a set of numbers that all keyboard characters are converted to. You can find the ASCII code at&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.asciitable.com/&quot;&gt;&lt;u&gt;&lt;span style=&quot;color: blue;&quot;&gt;http://www.asciitable.com/&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;/span&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
When you press and release a key of your keyboard, the actual character shown on the key is not stored in memory. Instead, a number is stored in memory. That number is the ASCII code for that character.&lt;br /&gt;
&lt;br /&gt;
The ascii code for the character &#39;a&#39; is 141 in octal. The following program assigns the character &#39;a&#39; to my_character and displays it. Then it assigns the ASCII code octal value 141 to my_character and displays it. The ASCII octal value 141 is displayed as the character &#39;a&#39;&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* Declare a character variable */&lt;br /&gt;
&lt;br /&gt;
char my_character;&lt;br /&gt;
&lt;br /&gt;
/* Assign my_character the letter &#39;a&#39; */&lt;br /&gt;
&lt;br /&gt;
my_character = &#39;a&#39;;&lt;br /&gt;
&lt;br /&gt;
/* This statement displays the letter &#39;a&#39; */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_character &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
/* Assign my_character the ASCII code for the letter &#39;a&#39; */&lt;br /&gt;
&lt;br /&gt;
/* The forward slash tells the compiler that the ASCII code is used instead of the letter. */&lt;br /&gt;
&lt;br /&gt;
my_character = &#39;\141&#39;;&lt;br /&gt;
&lt;br /&gt;
/* This statement also displays the letter &#39;a&#39; */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_character &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} /* end of main function */&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
In C++, the ampersand sign means the address of when a variable name is appended to it.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;my_variable means &#39;the address of my_variable. A pointer points to a variable. In other words, a pointer holds the address of a variable.&lt;br /&gt;
&lt;br /&gt;
The following program displays an integer in two ways. First it displays the integer via the variable my_variable which holds the integer. Then it displays the integer via the pointer my_pointer that points to my_variable.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* Lets declare a variable that holds an integer */&lt;br /&gt;
&lt;br /&gt;
int my_variable;&lt;br /&gt;
&lt;br /&gt;
/* Now lets declare a pointer*/&lt;br /&gt;
&lt;br /&gt;
/*The asterick denotes a pointer to&lt;br /&gt;
&lt;br /&gt;
a variable of type integer. */&lt;br /&gt;
&lt;br /&gt;
int *my_pointer;&lt;br /&gt;
&lt;br /&gt;
/* The pointer is declared but it does not point to any variable. Let my_pointer point to my_variable */&lt;br /&gt;
&lt;br /&gt;
my_pointer = &amp;amp;my_variable;&lt;br /&gt;
&lt;br /&gt;
/* Lets assign a value to my_variable */&lt;br /&gt;
&lt;br /&gt;
my_variable = 5;&lt;br /&gt;
&lt;br /&gt;
/* Display the integer stored in my_variable. */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_variable &amp;lt;&amp;lt; endl; /* Displays the integer 5 */&lt;br /&gt;
&lt;br /&gt;
/* Use the pointer my_pointer to display the integer in my_variable. */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; *my_pointer &amp;lt;&amp;lt; endl; /* Displays the integer 5 */&lt;br /&gt;
&lt;br /&gt;
} //end of main function&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
ARRAYS&lt;br /&gt;
&lt;br /&gt;
An array is a group of contiguous memory locations holding a string of values. The following program creates an array of integers named my_array[2]. The number 2 means there are two locations in this array. Those locations are my_array[0] and my_array[1]. The program places integer values in each location and then prints them one at a time.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* The following statement declares an array of two memory locations designated as holding integers. Each location holds one integer. The two memory locations are my_array[0] and my_array[1] */&lt;br /&gt;
&lt;br /&gt;
int my_array[2];&lt;br /&gt;
&lt;br /&gt;
/* Assign the value 4 to the first location of my_array */&lt;br /&gt;
&lt;br /&gt;
my_array[0] = 4;&lt;br /&gt;
&lt;br /&gt;
/* Assign the value 3 to the second location of my_array */&lt;br /&gt;
&lt;br /&gt;
my_array[1] = 3;&lt;br /&gt;
&lt;br /&gt;
/* Display the contents of the first location of my_array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_array[0] &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
/* Display the contents of the second location of my_array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_array[1] &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} // end of main function&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
The following program is the same as the last program except that the integers are assigned to my_array in the declaration of my_array.&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* The following statement declares an array of two memory locations designated as holding integers.and assigns the value 4 to the first location of the array and the value three to the second location of the array */&lt;br /&gt;
&lt;br /&gt;
int my_array[2] = {4, 3};&lt;br /&gt;
&lt;br /&gt;
/* Display the contents of the first location of my_array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_array[0] &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
/* Display the contents of the second location of my_array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_array[1] &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} // end of main function&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
We can also create an array of characters. The following program creates an array of characters. The array is named my_greeting. The program sets up a pointer to the array my_greeting and uses the pointer to display the greeting. The array of characters must be terminated with a null character. The null character denotes that all the characters have been printed.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
char *my_pointer;&lt;br /&gt;
&lt;br /&gt;
/* declare an array that will contain five characters&lt;br /&gt;
&lt;br /&gt;
and a null character. */&lt;br /&gt;
&lt;br /&gt;
char my_greeting[6];&lt;br /&gt;
&lt;br /&gt;
/* my_pointer must point to my_greeting */&lt;br /&gt;
&lt;br /&gt;
my_pointer = my_greeting;&lt;br /&gt;
&lt;br /&gt;
/* We can fill the array locations one by one with the following inefficient code */&lt;br /&gt;
&lt;br /&gt;
my_greeting[0] = &#39;h&#39;;&lt;br /&gt;
&lt;br /&gt;
my_greeting[1] = &#39;e&#39;;&lt;br /&gt;
&lt;br /&gt;
my_greeting[2] = &#39;l&#39;;&lt;br /&gt;
&lt;br /&gt;
my_greeting[3] = &#39;l&#39;;&lt;br /&gt;
&lt;br /&gt;
my_greeting[4] = &#39;o&#39;;&lt;br /&gt;
&lt;br /&gt;
/* We must add a null character to tell the compiler&lt;br /&gt;
&lt;br /&gt;
that this is the end of the array */&lt;br /&gt;
&lt;br /&gt;
my_greeting[5] = &#39;\0&#39;;&lt;br /&gt;
&lt;br /&gt;
/* Print only the first character of the array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; *my_pointer &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
/* Print the whole array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_pointer &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} /* end of main function */&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
The above program could have been written using two C++ statements in the main function.&lt;br /&gt;
&lt;br /&gt;
The following program is the same as the previous program except that it defines the characters in the pointer declaration. Note that the pointer declaration include the characters &quot;hello.&quot; This is called a character string. When defining the character string in this manner, the programmer need not worry about the terminating null character.&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* We could save time by filling the array in the declaration of the pointer */&lt;br /&gt;
&lt;br /&gt;
const char *my_pointer = &quot;hello&quot;; /* generates compiler error */&lt;br /&gt;
&lt;br /&gt;
/* &quot;hello&quot; is a character string that exists in the array my_greeting[]&lt;br /&gt;
&lt;br /&gt;
my_greeting[0] is pointed to by the pointer my_pointer. */&lt;br /&gt;
&lt;br /&gt;
/* Display the message &quot;hello&quot; */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_pointer &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
/* Print only the character &#39;h&quot; */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; *my_pointer &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} //end of main function&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
The following program uses the variable i as an index into my_array. Then it uses the pointer my_pointer to display the contents of my_array.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* declare integer i and set it equal to 0. */&lt;br /&gt;
&lt;br /&gt;
int i = 0;&lt;br /&gt;
&lt;br /&gt;
/* declare a pointer */&lt;br /&gt;
&lt;br /&gt;
char *my_pointer;&lt;br /&gt;
&lt;br /&gt;
/* Declare an array of two characters */&lt;br /&gt;
&lt;br /&gt;
char my_array[3];&lt;br /&gt;
&lt;br /&gt;
/* my_pointer must point to my_array */&lt;br /&gt;
&lt;br /&gt;
my_pointer = my_array;&lt;br /&gt;
&lt;br /&gt;
/* Use the value of i as the index into the array. */&lt;br /&gt;
&lt;br /&gt;
/* Save the character &#39;H&#39; in my_array[0] */&lt;br /&gt;
&lt;br /&gt;
my_array[i] = &#39;H&#39;;&lt;br /&gt;
&lt;br /&gt;
/* Increment i by 1 */&lt;br /&gt;
&lt;br /&gt;
i++;&lt;br /&gt;
&lt;br /&gt;
/* Save the character &#39;e&#39; in my_array[1] */&lt;br /&gt;
&lt;br /&gt;
my_array[i] = &#39;e&#39;;&lt;br /&gt;
&lt;br /&gt;
i++;&lt;br /&gt;
&lt;br /&gt;
/* Save a null character in my_array[2] */&lt;br /&gt;
&lt;br /&gt;
my_array = &#39;\0&#39;;&lt;br /&gt;
&lt;br /&gt;
/* Display my_array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_pointer &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} /* end of main function */&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
We can also increment and decrement pointers.&lt;br /&gt;
&lt;br /&gt;
The following program declares an array my_array and then uses the pointer my_pointer to point to specific locations of the array and store integers in the array.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* declare the index variable i */&lt;br /&gt;
&lt;br /&gt;
int i = 0;&lt;br /&gt;
&lt;br /&gt;
/* declare the character array my_array */&lt;br /&gt;
&lt;br /&gt;
char my_array[3];&lt;br /&gt;
&lt;br /&gt;
/* declare the pointer my_pointer */&lt;br /&gt;
&lt;br /&gt;
char *my_pointer;&lt;br /&gt;
&lt;br /&gt;
/* my_pointer must point to my_array */&lt;br /&gt;
&lt;br /&gt;
my_pointer = my_array;&lt;br /&gt;
&lt;br /&gt;
/* Store an &#39;H&quot; in my_array[0] */&lt;br /&gt;
&lt;br /&gt;
*my_pointer = &#39;H&#39;;&lt;br /&gt;
&lt;br /&gt;
/* point to my_array[1] */&lt;br /&gt;
&lt;br /&gt;
my_pointer++;&lt;br /&gt;
&lt;br /&gt;
/* Store an &#39;e&#39; in my_array[1] */&lt;br /&gt;
&lt;br /&gt;
*my_pointer = &#39;e&#39;;&lt;br /&gt;
&lt;br /&gt;
my_pointer++;&lt;br /&gt;
&lt;br /&gt;
/* store a null character in my_array[2] */&lt;br /&gt;
&lt;br /&gt;
*my_pointer = &#39;\0&#39;;&lt;br /&gt;
&lt;br /&gt;
/* Reset the pointer to the first location of the string */&lt;br /&gt;
&lt;br /&gt;
my_pointer = my_array;&lt;br /&gt;
&lt;br /&gt;
/* Display the character string in my_array. */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; my_pointer &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} /* end of main function */&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
The following programs shows a property of the increment operator. The statement&lt;br /&gt;
&lt;br /&gt;
my_array[i++] = &#39;T&#39;;&lt;br /&gt;
&lt;br /&gt;
places the letter T in my_array[i] and then increments i.&lt;br /&gt;
&lt;br /&gt;
The statement&lt;br /&gt;
&lt;br /&gt;
my_array[++i] = &#39;T&#39;;&lt;br /&gt;
&lt;br /&gt;
increments i and then stores the letter T in my_array[i].&lt;br /&gt;
&lt;br /&gt;
After placing the characters &#39;t&#39;, &#39;e&#39;, &#39;s&#39;, &#39;t&#39; and a null character in the array. The program displays the word text.&lt;br /&gt;
&lt;br /&gt;
/**** place the include iostream statement here ****/&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
/* declare a character pointer */&lt;br /&gt;
&lt;br /&gt;
char *array_ptr;&lt;br /&gt;
&lt;br /&gt;
/* Declare a array of characters */&lt;br /&gt;
&lt;br /&gt;
char my_array[7];&lt;br /&gt;
&lt;br /&gt;
/* Declare and initialize the array index i */&lt;br /&gt;
&lt;br /&gt;
int i = 0;&lt;br /&gt;
&lt;br /&gt;
/* The pointer must point to the array *?&lt;br /&gt;
&lt;br /&gt;
array_ptr = my_array;&lt;br /&gt;
&lt;br /&gt;
/* store the character &#39;T&#39; in my_array[i] and then increment i. */&lt;br /&gt;
&lt;br /&gt;
my_array[i++] = &#39;T&#39;;&lt;br /&gt;
&lt;br /&gt;
/* Store an &#39;e&#39; in my_array[1] */&lt;br /&gt;
&lt;br /&gt;
my_array[i] = &#39;e&#39;;&lt;br /&gt;
&lt;br /&gt;
/* This statement increments i and then stores a the character &#39;s&#39; in my_array[i] */&lt;br /&gt;
&lt;br /&gt;
my_array[++i] = &#39;s&#39;;&lt;br /&gt;
&lt;br /&gt;
i++; /*increment i */&lt;br /&gt;
&lt;br /&gt;
/* This statement stores the character &#39;t&#39; in my_array[i] and then increments i. */&lt;br /&gt;
&lt;br /&gt;
my_array[i++] = &#39;t&#39;;&lt;br /&gt;
&lt;br /&gt;
/* Insert a null character in my_array */&lt;br /&gt;
&lt;br /&gt;
my_array[i] = &#39;\0&#39;;&lt;br /&gt;
&lt;br /&gt;
/* display the contents of my_array */&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; array_ptr &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
} /* end of main function */&lt;br /&gt;
&lt;br /&gt;
/******* End of program *******/&lt;br /&gt;
&lt;br /&gt;
References: My own experiences during my career as a embedded systems software engineer.&lt;br /&gt;
&lt;br /&gt;
The book &#39;C++ THE COMPLETE REFERENCE&#39; by Herbert Schildt.&lt;br /&gt;
&lt;br /&gt;
ISBN 0-07-222680-3&lt;br /&gt;
&lt;span lang=&quot;ZH-CN&quot; style=&quot;font-family: SimSun;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span lang=&quot;ZH-CN&quot; style=&quot;font-family: SimSun;&quot;&gt;&lt;br /&gt;

&lt;/span&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span lang=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/6642865261381375876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/6642865261381375876' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/6642865261381375876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/6642865261381375876'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/cplusplus-understanding-arrays.html' title='Cplusplus: Understanding Arrays, Character Strings, and Pointers'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-3543742577940935847</id><published>2012-01-13T01:46:00.001-08:00</published><updated>2012-01-13T02:11:10.048-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="case"/><category scheme="http://www.blogger.com/atom/ns#" term="switch statement"/><title type='text'>The Cplusplus Programming Language Switch Statement</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I orignally published this article on Yahoo Voices under the pen name John Mario. &lt;br /&gt;
&lt;br /&gt;
This Tutorial covers the C++ switch statement. &lt;br /&gt;
&lt;br /&gt;
The basic form of the switch statement is shown below. The names of the variables in this switch statement describe their function. The case_identifier_value defines which case will be executed. Each case begins with a case statement ends with a break statement as shown below. Each time the switch statement is called, only one case is executed. The C++ statements between the case statement and the break statement comprise the response for that particular input. The case_identifier_value can be an integer or a letter of the alphabet. If the switch statement receives an invalid case_identifier_value, the default case is executed. The default case starts with &#39;default:&#39; and ends with a break statement.&lt;br /&gt;
&lt;br /&gt;
BASIC FORM OF SWITCH STATEMENT&lt;br /&gt;
&lt;br /&gt;
switch (case_identifier)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
case(case_identifier_value) // case for a specific value of case_identifier_value&lt;br /&gt;
&lt;br /&gt;
// case_identifier_value value must be number or letter&lt;br /&gt;
&lt;br /&gt;
//C++ statements for responding to a specific case_identifier_value&lt;br /&gt;
&lt;br /&gt;
break; // end of case&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
&lt;br /&gt;
// one case exists for each&lt;br /&gt;
&lt;br /&gt;
// valid case_identifier_value&lt;br /&gt;
&lt;br /&gt;
default:&lt;br /&gt;
&lt;br /&gt;
// The default case contains C++ statements&lt;br /&gt;
&lt;br /&gt;
// that respond to&lt;br /&gt;
&lt;br /&gt;
// invalid case_identifier_values&lt;br /&gt;
&lt;br /&gt;
break; //end of default case&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
FIRST C++ PROGRAM CONTAINING SWITCH STATEMENT&lt;br /&gt;
&lt;br /&gt;
A sample program containing a switch statement is shown below. In this program, the switch statement excutes a case based on an integer.&lt;br /&gt;
&lt;br /&gt;
// place include iostream statement here&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
int count; //declare the variable count&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Type a number less than 6 &quot; &amp;lt;&amp;lt; endl; //instruct user &lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; count; // await keyboard entry&lt;br /&gt;
&lt;br /&gt;
switch(count)&lt;br /&gt;
&lt;br /&gt;
/******************************&lt;br /&gt;
&lt;br /&gt;
This switch statement executes&lt;br /&gt;
&lt;br /&gt;
one of the cases below based on the&lt;br /&gt;
&lt;br /&gt;
value of count.&lt;br /&gt;
&lt;br /&gt;
Note that each time the switch statement&lt;br /&gt;
&lt;br /&gt;
is executed only one case is executed&lt;br /&gt;
&lt;br /&gt;
or the default case is executed.&lt;br /&gt;
&lt;br /&gt;
******************************/&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
case 0: //If count equals 0, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count = &quot; &amp;lt;&amp;lt; count &amp;lt;&amp;lt; endl; //display count of 0 &lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case 1: //If count equals 1, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count = &quot; &amp;lt;&amp;lt; count &amp;lt;&amp;lt; endl; //display count of 1 &lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case 2: //If count equals 2, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count = &quot; &amp;lt;&amp;lt; count &amp;lt;&amp;lt; endl; // display count of 2&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case 3: //If count equals 3, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count = &quot; &amp;lt;&amp;lt; count &amp;lt;&amp;lt; endl; //display count of 3 &lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case 4: //If count equals 4, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count = &quot; &amp;lt;&amp;lt; count &amp;lt;&amp;lt; endl; // display count of 4&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case 5: //If count equals 5, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count = &quot; &amp;lt;&amp;lt; count &amp;lt;&amp;lt; endl; // display count of 5&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
default: // default case: execute if count is not between 1 and 5&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;count out of range&quot; &amp;lt;&amp;lt; endl; // display count out of range&lt;br /&gt;
&lt;br /&gt;
break; //exit switch statement&lt;br /&gt;
&lt;br /&gt;
} //end of switch statement&lt;br /&gt;
&lt;br /&gt;
} // end of main&lt;br /&gt;
&lt;br /&gt;
SECOND C++ PROGRAM USING SWITCH STATEMENT&lt;br /&gt;
&lt;br /&gt;
The switch statement can also execute cases based on a character input. In the following program we use the switch statement to accept one of the following letters: a, b, c, d, e.&lt;br /&gt;
&lt;br /&gt;
//place include iostream statement here&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
char answer; //declare the variable answer&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Type in one of the first five letters of the alphabet&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; answer; // await keyboard entry&lt;br /&gt;
&lt;br /&gt;
switch(answer) //Execute case based on answer&lt;br /&gt;
&lt;br /&gt;
// Note that each time the switch statement&lt;br /&gt;
&lt;br /&gt;
// is executed only one case is executed&lt;br /&gt;
&lt;br /&gt;
// or the default case is executed.&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
case &#39;a&#39;: //If answer equals &#39;a&#39;, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer = a&quot; &amp;lt;&amp;lt; endl; //display answer&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case &#39;b&#39;: //If answer equals &#39;b&#39;, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer = b&quot; &amp;lt;&amp;lt; endl; // display answer&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case &#39;c&#39;: //If answer equals &#39;c&#39;, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer = c&quot; &amp;lt;&amp;lt; endl; //display answer&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case &#39;d&#39;: //If answer equals &#39;d&#39;, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer = d&quot; &amp;lt;&amp;lt; endl; // display answer&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
case &#39;e&#39;: //If answer equals &#39;e&#39;, this case is executed&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer = e&quot; &amp;lt;&amp;lt; endl; // display answer&lt;br /&gt;
&lt;br /&gt;
break; // exit from switch statement&lt;br /&gt;
&lt;br /&gt;
default: // default case: execute if answer is not a, b, c, d or e&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;invalid answer&quot; &amp;lt;&amp;lt; endl; // display error message&lt;br /&gt;
&lt;br /&gt;
break; // end of default case&lt;br /&gt;
&lt;br /&gt;
} //end of switch statement&lt;br /&gt;
&lt;br /&gt;
} //end of main function&lt;br /&gt;
&lt;br /&gt;
A PRACTICAL USE OF THE C++ SWITCH STATEMENT&lt;br /&gt;
&lt;br /&gt;
The following is a practicle example. The actual C++ statements in each case are replaced with an explanation of what those C++ statements do.&lt;br /&gt;
&lt;br /&gt;
//Place include iostream statement here&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
int command_input;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;select item number from menu&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;1 Print list of employees&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;2 Print list of employee wages&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;3 Print list of new employees&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;4 Print list of managers&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;5 Print list of manager salaries&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; command_input;&lt;br /&gt;
&lt;br /&gt;
switch (command_input)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
case 1:&lt;br /&gt;
&lt;br /&gt;
//The C++ statements for this case&lt;br /&gt;
&lt;br /&gt;
// print a list of employees&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
&lt;br /&gt;
case 2:&lt;br /&gt;
&lt;br /&gt;
//The C++ statements for this case&lt;br /&gt;
&lt;br /&gt;
//print a list of employee wages&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
&lt;br /&gt;
case 3:&lt;br /&gt;
&lt;br /&gt;
//The C++ statements for this case&lt;br /&gt;
&lt;br /&gt;
//prints a list of new employees&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
&lt;br /&gt;
case 4:&lt;br /&gt;
&lt;br /&gt;
//The C++ statements for this case&lt;br /&gt;
&lt;br /&gt;
//Prints a list of managers&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
&lt;br /&gt;
case (5):&lt;br /&gt;
&lt;br /&gt;
//The C++ statements for this case&lt;br /&gt;
&lt;br /&gt;
//Print a list of manager salaries&lt;br /&gt;
&lt;br /&gt;
default:&lt;br /&gt;
&lt;br /&gt;
//The C++ statements for this case&lt;br /&gt;
&lt;br /&gt;
//responds to the invalid command_input&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
&lt;br /&gt;
} //end of switch statement&lt;br /&gt;
&lt;br /&gt;
} //end of main function&lt;br /&gt;
&lt;br /&gt;
References:  &lt;br /&gt;
&lt;br /&gt;
My own experiences during my career as a embedded systems software engineer.&lt;br /&gt;
&lt;br /&gt;
The book &#39;C++ THE COMPLETE REFERENCE&#39; by Herbert Schildt.&lt;br /&gt;
&lt;br /&gt;
ISBN 0-07-222680-3 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span lang=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/3543742577940935847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/3543742577940935847' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/3543742577940935847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/3543742577940935847'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/cplusplus-programming-language-switch.html' title='The Cplusplus Programming Language Switch Statement'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-2479428531767096816</id><published>2012-01-13T01:43:00.000-08:00</published><updated>2012-01-13T02:12:34.764-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="else"/><category scheme="http://www.blogger.com/atom/ns#" term="expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="IF statement"/><category scheme="http://www.blogger.com/atom/ns#" term="operators"/><title type='text'>C++ EXPRESSIONS AND OPERATORS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
I originally published this article on Yahoo Voices under the pen name John Mario.&lt;br /&gt;
&lt;br /&gt;
THE IF STATEMENT&lt;br /&gt;
&lt;br /&gt;
The simplest of the C++ control statements is the IF statement. This article will use the IF statement to explain the use of expressions and operators.&lt;br /&gt;
&lt;br /&gt;
The best example of the IF statement are the ones written in plain English. Note that the examples are enclosed in double astericks.&lt;br /&gt;
&lt;br /&gt;
The basic form of the IF statement is&lt;br /&gt;
&lt;br /&gt;
&#39;if condition then action&lt;br /&gt;
&lt;br /&gt;
else some other action&#39;&lt;br /&gt;
&lt;br /&gt;
The condition is an expression containing variables and operators.&lt;br /&gt;
&lt;br /&gt;
Here is an example written in the Englsigh language.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
If it is raining then bring the umbrella&lt;br /&gt;
&lt;br /&gt;
Else leave the umbrella home.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
The condition is &#39;is it raining.&#39;&lt;br /&gt;
&lt;br /&gt;
The possible reactions are bring the umbrella or don&#39;t bring the umbrella. &lt;br /&gt;
&lt;br /&gt;
In the C++ programming language, the condition is always placed in parenthesis.&lt;br /&gt;
&lt;br /&gt;
THE == OPERATOR&lt;br /&gt;
&lt;br /&gt;
The first operator we will consider is the operator ==.&lt;br /&gt;
&lt;br /&gt;
This operator is used to determine if two values are equal. It is used in the IF statement within the following C++ program.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
char answer; // The variable answer will contain a character&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Will it rain today? &quot; &amp;lt;&amp;lt; endl; //Ask the user to a question&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Type y for yes or n for no&quot; &amp;lt;&amp;lt; endl; // Give user choice of answers&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; answer; //Accept answer from user&lt;br /&gt;
&lt;br /&gt;
If (answer == &#39;y&#39;) //test answer of &#39;y&#39;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Bring Umbrella&quot; &amp;lt;&amp;lt; endl; // It will rain. Tell user to bring umbrella&lt;br /&gt;
&lt;br /&gt;
Else&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Leave umbrella home&quot; &amp;lt;&amp;lt; endl; //It won&#39;t rain. Leave umbrella home&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
The double equal sign indicates a comparison.&lt;br /&gt;
&lt;br /&gt;
If the user makes the mistake of using a single equal sign in the expression , the ELSE statement will never be executed.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
If (answer = &#39;y&#39;) // Error. Expression will assign &#39;y&#39; to answer&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Bring Umbrella&quot; &amp;lt;&amp;lt; endl; // Will always execute.&lt;br /&gt;
&lt;br /&gt;
Else&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Leave umbrella home&quot; &amp;lt;&amp;lt; endl; //Will never execute. &lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
The reason is the single equal sign means assign the variable to the left of the equal statement the value on the right of the equal statement. This IF statement would unconditionally assign the character &#39;y&#39; to the variable &#39;answer.&#39;&lt;br /&gt;
&lt;br /&gt;
THE != OPERARATOR&lt;br /&gt;
&lt;br /&gt;
The operator != means &#39;not equal to.&#39;&lt;br /&gt;
&lt;br /&gt;
answer != &#39;y&#39;&lt;br /&gt;
&lt;br /&gt;
means answer is not equal to &#39;y&#39;&lt;br /&gt;
&lt;br /&gt;
The IF statement&lt;br /&gt;
&lt;br /&gt;
if (answer != &#39;y&#39;)&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; answer;&lt;br /&gt;
&lt;br /&gt;
displays answer if the variable answer does not contain the character &#39;y&#39; &lt;br /&gt;
&lt;br /&gt;
THE &amp;gt; OPERATOR&lt;br /&gt;
&lt;br /&gt;
The operator &amp;gt; means &#39;is greater than.&#39;&lt;br /&gt;
&lt;br /&gt;
The expression&lt;br /&gt;
&lt;br /&gt;
answer &amp;gt; 4&lt;br /&gt;
&lt;br /&gt;
in the IF statement&lt;br /&gt;
&lt;br /&gt;
if (answer &amp;gt; 4)&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; answer;&lt;br /&gt;
&lt;br /&gt;
tests the value in the variable answer for a value greater than 4.&lt;br /&gt;
&lt;br /&gt;
If the variable answer has a value that is greater than four than the value is displayed.&lt;br /&gt;
&lt;br /&gt;
THE &amp;gt;= OPERATOR&lt;br /&gt;
&lt;br /&gt;
The operator &amp;gt;= means &#39;greater than or equal to.&#39;&lt;br /&gt;
&lt;br /&gt;
The instruction&lt;br /&gt;
&lt;br /&gt;
if (answer &amp;gt;= 4)&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; answer;&lt;br /&gt;
&lt;br /&gt;
means &quot;if answer is greater than or equal to four, display answer.&quot;&lt;br /&gt;
&lt;br /&gt;
THE &amp;lt;= OPERATOR&lt;br /&gt;
&lt;br /&gt;
The operator &amp;lt;= means &#39;less than or equal to.&#39;&lt;br /&gt;
&lt;br /&gt;
The instruction&lt;br /&gt;
&lt;br /&gt;
if (answer &amp;lt;= 4)&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; answer;&lt;br /&gt;
&lt;br /&gt;
means &quot;if answer is less than or equal to four, display answer.&quot;&lt;br /&gt;
&lt;br /&gt;
THE &amp;amp;&amp;amp; OPERATOR&lt;br /&gt;
&lt;br /&gt;
The &amp;amp;&amp;amp; operator means AND.&lt;br /&gt;
&lt;br /&gt;
If condition one exists and condition two exists do this.&lt;br /&gt;
&lt;br /&gt;
Both condition one and condition two must be true.&lt;br /&gt;
&lt;br /&gt;
The statement&lt;br /&gt;
&lt;br /&gt;
if ((expression one) &amp;amp;&amp;amp; (expression two))&lt;br /&gt;
&lt;br /&gt;
means &quot;if expression one is true AND expression two is true.&lt;br /&gt;
&lt;br /&gt;
The &amp;amp;&amp;amp; operator allows us to test for a range of values. Consider the following C++ program:&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
int answer; //answer will hold an integer&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Type in one of the integers 4, 5, 6, 7, or 8 &quot;; //ask user for integer value&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; answer; // Accept answer from user.&lt;br /&gt;
&lt;br /&gt;
if ((answer &amp;gt;= 4) &amp;amp;&amp;amp; (answer &amp;lt;= 8))&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer = &quot; &amp;lt;&amp;lt; answer &amp;lt;&amp;lt; endl; //Answer within rage. Display answer.&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;answer out of range.&quot; &amp;lt;&amp;lt; endl; //Tell user the answer is out of range.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
THE || OPERATOR.&lt;br /&gt;
&lt;br /&gt;
The || operator means &#39;or.&#39;&lt;br /&gt;
&lt;br /&gt;
The expression &#39;condition one OR condition two&#39; means &#39;if either condition is true.&#39;&lt;br /&gt;
&lt;br /&gt;
The statement&lt;br /&gt;
&lt;br /&gt;
if ((condition one) || (condition two))&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; answer;&lt;br /&gt;
&lt;br /&gt;
means &quot; if condition one is true or condition two is true, display answer. &lt;br /&gt;
&lt;br /&gt;
The || operator allows us to testing for a one of two values. Consider the following program.&lt;br /&gt;
&lt;br /&gt;
**&lt;br /&gt;
&lt;br /&gt;
char answer; //answer will contain a character&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; are you at least 18 years old? (y/n)&quot;; //ask user a question &lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; answer //Accept answer&lt;br /&gt;
&lt;br /&gt;
if ((answer == &#39;y&#39;) || (answer == &#39;n&#39;))&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; answer; //Answer is &#39;y&#39; or &#39;n&#39; Display answer.&lt;br /&gt;
&lt;br /&gt;
Else&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Error! Enter y for yes or n for no&quot; &amp;lt;&amp;lt; endl; // answer is not acceptable.&lt;br /&gt;
&lt;br /&gt;
** &lt;br /&gt;
References: My own experiences during my career as a embedded systems software engineer.&lt;br /&gt;
&lt;br /&gt;
The book &#39;C++ THE COMPLETE REFERENCE&#39; by Herbert Schildt.&lt;br /&gt;
&lt;br /&gt;
ISBN 0-07-222680-3&lt;br /&gt;
&lt;span lang=&quot;ZH-CN&quot; style=&quot;font-family: SimSun;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span lang=&quot;ZH-CN&quot; style=&quot;font-family: SimSun;&quot;&gt;&lt;br /&gt;

&lt;/span&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span lang=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/2479428531767096816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/2479428531767096816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2479428531767096816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/2479428531767096816'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/c-expressions-and-operators.html' title='C++ EXPRESSIONS AND OPERATORS'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-5596884544138223661</id><published>2012-01-13T01:39:00.000-08:00</published><updated>2012-01-13T02:15:02.022-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="assignment statements"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="comment"/><category scheme="http://www.blogger.com/atom/ns#" term="iostream"/><category scheme="http://www.blogger.com/atom/ns#" term="keywords"/><category scheme="http://www.blogger.com/atom/ns#" term="main function"/><category scheme="http://www.blogger.com/atom/ns#" term="namespace"/><category scheme="http://www.blogger.com/atom/ns#" term="programming language"/><category scheme="http://www.blogger.com/atom/ns#" term="variables"/><title type='text'>INTRODUCTION TO THE C++ PROGRAMMING LANGUAGE</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
I orginally published this article on Yahoo Voices under the pen name John Mario.&lt;br /&gt;
&lt;br /&gt;
The purpose of this series of articles is to explain the C++ programming language to the reader who wants to learn C++.&lt;br /&gt;
&lt;br /&gt;
OVERVIEW OF THE C++ PROGRAMMING LANGUAGE&lt;br /&gt;
&lt;br /&gt;
The C++ language is a versatile, structured programming language with extensive libraries of functions available for the programmer&#39;s use. The language is used for console applications, windows applications and application in modern appliances and industrial equipment.&lt;br /&gt;
&lt;br /&gt;
WHAT IS A PROGRAM?&lt;br /&gt;
&lt;br /&gt;
A program is a series of steps the computer performs to attain a specific result of set of results. The steps are written in a specific programming language such as C++. The programming language consists of a number of instructions that can be used in the design of any computer program. Every C++ instruction is terminated with a semi-colon.&lt;br /&gt;
&lt;br /&gt;
A console application is a program that uses the old DOS-like screen. A console application does not use windows. Each output is sent directly to the monitor.&lt;br /&gt;
&lt;br /&gt;
C++ LIBRARIES&lt;br /&gt;
&lt;br /&gt;
Libraries contain functions for the programmer&#39;s use. A function is a routine that performs a specific operation. For example, the square root function takes the square root of a number. The C++ programming language includes a class library and a standard function library derived from the C language. A class contains an encapsulated group of related functions and variables. Variables are defined in this article. Classes and functions will be discussed in future articles.&lt;br /&gt;
&lt;br /&gt;
In order to display anything on the monitor, we include the library class iostream. The library class iostream is a library of generic input and output functions provided for the programmer with any C++ compiler. To access the functions in iostream we need an include statement. The include statement of the library class iostream. begins with the pound sign.&lt;br /&gt;
&lt;br /&gt;
# include &amp;lt; iostream &amp;gt; // include the library class iostream. &lt;br /&gt;
// note that spaces are not allowed between &amp;lt; and &amp;gt; &lt;br /&gt;
// spaces were included to overcome a text editor problem. &lt;br /&gt;
&lt;br /&gt;
NAMESPACE&lt;br /&gt;
&lt;br /&gt;
Namespace prevents conflicts between programmer functions and library functions having the same name. This statement should be inserted below the include statement in every C++ program.&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
Without the statement &#39;using namespace std&#39;, the compiler will return numerous errors.&lt;br /&gt;
&lt;br /&gt;
THE MAIN FUNCTION&lt;br /&gt;
&lt;br /&gt;
Every C++ program must have a &#39;main&#39; function. The main function is not part of iostream. The main function defines the start of the program. The &#39;main&#39; function is implemented as follows:&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
// The program is typed in between the two curly brackets&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Let&#39;s examine the &#39;main&#39; function.&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
The keyword int means the function &#39;main&#39; will return an integer value. An integer value is a whole number. In the program at the end of this article, a zero is returned.&lt;br /&gt;
&lt;br /&gt;
The space between the parentheses is used to pass information to a function. (void) means no variables are passed to the &#39;main&#39; function.&lt;br /&gt;
&lt;br /&gt;
COMMENTS&lt;br /&gt;
&lt;br /&gt;
Any program should also contain comments. Comments help a new programmer understand the program and are often helpful when modifying an old program.&lt;br /&gt;
&lt;br /&gt;
The C++ compiler recognizes any line that begins with a double slash // as a comment.&lt;br /&gt;
&lt;br /&gt;
// This line is a comment&lt;br /&gt;
&lt;br /&gt;
A comment could also start with /* and end with */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
This line is a comment&lt;br /&gt;
&lt;br /&gt;
This line is another comment.&lt;br /&gt;
&lt;br /&gt;
There is no need for two slashes because we are using the slash and asterisk&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
If you have a comment that is several lines long, you might try this technique so your comments clearly stand out&lt;br /&gt;
&lt;br /&gt;
/******************************************************* &lt;br /&gt;
Add your long comment here. &lt;br /&gt;
It could be a long as you want.&lt;br /&gt;
&lt;br /&gt;
********************************************************/&lt;br /&gt;
&lt;br /&gt;
KEYWORDS&lt;br /&gt;
&lt;br /&gt;
The C++ language uses keywords for types of data. The keywords int, double, float and char are common keywords used in programs. The keyword int means integer.&lt;br /&gt;
&lt;br /&gt;
examples:&lt;br /&gt;
&lt;br /&gt;
59 is an integer&lt;br /&gt;
&lt;br /&gt;
A double is a number containing a decimal point&lt;br /&gt;
&lt;br /&gt;
54.35 is a double&lt;br /&gt;
&lt;br /&gt;
A floating point number is a number like 5.3 x 10^-2&lt;br /&gt;
&lt;br /&gt;
5.3e-2F is a floating point number. The keyword for a floating point number is float. &#39;e-2&#39; means x 10^-2 wherein ^ means &#39;raised to the power of&#39;&lt;br /&gt;
&lt;br /&gt;
Char stands for character. A character is any key on your keyboard. A single character is enclosed in single quotation marks&lt;br /&gt;
&lt;br /&gt;
&#39;a&#39; is a char.&lt;br /&gt;
&lt;br /&gt;
&#39;1&#39; is a char.&lt;br /&gt;
&lt;br /&gt;
&#39;;&#39; is a char.&lt;br /&gt;
&lt;br /&gt;
VARIABLES&lt;br /&gt;
&lt;br /&gt;
A variable is a name assigned to a memory location. A declaration defines exactly what is stored in that memory location.&lt;br /&gt;
&lt;br /&gt;
In the following instruction, the keyword &#39;int&#39; declares that the variable first_value will hold an integer. Only integers can be stored in the memory location named first_value.&lt;br /&gt;
&lt;br /&gt;
int first_value;&lt;br /&gt;
&lt;br /&gt;
The following instruction declares that the variable my_number will hold a double.&lt;br /&gt;
&lt;br /&gt;
double my_number;&lt;br /&gt;
&lt;br /&gt;
The following instruction declares that the variable my_floating_pt will hold a floating point number.&lt;br /&gt;
&lt;br /&gt;
float my_floating_pt;&lt;br /&gt;
&lt;br /&gt;
The following instruction declares that the variable my_character will hold a character.&lt;br /&gt;
&lt;br /&gt;
char my_character;&lt;br /&gt;
&lt;br /&gt;
ASSIGNMENT STATEMENTS&lt;br /&gt;
&lt;br /&gt;
An assignment statement assigns a value to a variable.&lt;br /&gt;
&lt;br /&gt;
Consider the following examples;&lt;br /&gt;
&lt;br /&gt;
int a;&lt;br /&gt;
&lt;br /&gt;
a = &#39;1&#39;; //this line will deliver an error because&lt;br /&gt;
&lt;br /&gt;
// &#39;1&#39; is a character&lt;br /&gt;
&lt;br /&gt;
a = 1; // this instruction places the integer 1 in the memory location named a.&lt;br /&gt;
&lt;br /&gt;
char b;&lt;br /&gt;
&lt;br /&gt;
b = &#39;1&#39;; // this instruction places the character &#39;1&#39; in the memory location named b.&lt;br /&gt;
&lt;br /&gt;
Instead of using one instruction to define each variable, we can use one instruction to define all three variables by listing the variables and separating them with commas.&lt;br /&gt;
&lt;br /&gt;
int first_value, second_value, sum_of_values;&lt;br /&gt;
&lt;br /&gt;
To store a value to a memory location, we use an assignment statement&lt;br /&gt;
&lt;br /&gt;
Consider the following instructions.&lt;br /&gt;
&lt;br /&gt;
int first_value;&lt;br /&gt;
&lt;br /&gt;
first_value = 5; // The integer 5 is stored is stored in&lt;br /&gt;
&lt;br /&gt;
// the memory location named first_value&lt;br /&gt;
&lt;br /&gt;
The above two statements can be combined.&lt;br /&gt;
&lt;br /&gt;
The following statement declares the variable first_value to hold an integer and assigns it a value of 5.&lt;br /&gt;
&lt;br /&gt;
int first_value = 5;&lt;br /&gt;
&lt;br /&gt;
First_value can be changed inside the program&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt; iostream &amp;gt; // spaces are not allowed between &amp;lt; and &amp;gt; &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
int ax = 4;&lt;br /&gt;
&lt;br /&gt;
// Later in the program, the value of ax is changed.&lt;br /&gt;
&lt;br /&gt;
ax = 5; //okay&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
CONSTANTS&lt;br /&gt;
&lt;br /&gt;
A constant is a value that cannot be changed. The keyword for constant is CONST. Consider the following declaration:&lt;br /&gt;
&lt;br /&gt;
const char my_constant = &#39;a&#39;;&lt;br /&gt;
&lt;br /&gt;
This statement declares that the variable my_constant will hold a the character &#39;a&#39;. If the programmer tries to change the character, the compiler will return an error.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt; iostream &amp;gt; // note: spaces are not allowed between &amp;lt; and &amp;gt; &lt;br /&gt;
// spaces were included to overcome text editor problem.&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
int a;&lt;br /&gt;
&lt;br /&gt;
a = 5;&lt;br /&gt;
&lt;br /&gt;
const char my_constant = &#39;a&#39;;&lt;br /&gt;
&lt;br /&gt;
my_constant = &#39;b&#39;; //error: cannot change a constant.&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
COUT AND CIN FUNCTIONS&lt;br /&gt;
&lt;br /&gt;
The cout function is a member of the iostream class library.&lt;br /&gt;
&lt;br /&gt;
&#39;Cout&#39; sends messages to be displayed on the monitor. Consider the following short program.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt; iostream &amp;gt; // spaces are not allowed between &amp;lt; and &amp;gt; &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
int a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = 5,&lt;br /&gt;
&lt;br /&gt;
b = 10;&lt;br /&gt;
&lt;br /&gt;
c = 20;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; a &amp;lt;&amp;lt; &#39; &#39; &amp;lt;&amp;lt; b &amp;lt;&amp;lt; &#39; &#39;&amp;lt;&amp;lt; c &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;end&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The output of this program excerpt would be&lt;br /&gt;
&lt;br /&gt;
5 10 20&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
The cin function is also a member of the iostream class library.&lt;br /&gt;
&lt;br /&gt;
The cin function reads an entry from the keyboard and stores it in a memory location.&lt;br /&gt;
&lt;br /&gt;
int my_number;&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; my_number;&lt;br /&gt;
&lt;br /&gt;
The instruction cin &amp;gt;&amp;gt; my_number reads an integer from the keyboard and stores it in the memory location named my_number. If the user types anything but an integer, the cin function will fail.&lt;br /&gt;
&lt;br /&gt;
PERFORMING ADDITION&lt;br /&gt;
&lt;br /&gt;
The following instruction adds the values in first_value and second_value &lt;br /&gt;
&lt;br /&gt;
and stores the result in sum_of_values.&lt;br /&gt;
&lt;br /&gt;
sum_of_values = first_value + second_value;&lt;br /&gt;
&lt;br /&gt;
WRITE PROGRAM IN THE ENGLISH LANGUAGE&lt;br /&gt;
&lt;br /&gt;
Let&#39;s consider a program that adds two integers and saves the result. An integer is a whole number.&lt;br /&gt;
&lt;br /&gt;
First we&#39;ll state the individual steps of the program in English.&lt;br /&gt;
&lt;br /&gt;
A variable is the name of a memory location that contains data. When we declare a variable, we must declare what type of data that variable will contain.&lt;br /&gt;
&lt;br /&gt;
Define three variables as integers. Name them first_value, second_value and sum_of_values.&lt;br /&gt;
&lt;br /&gt;
Prompt the user assign integer values to first_value and second_value.&lt;br /&gt;
&lt;br /&gt;
Add first_value and second_value and store the sum in sum_of_values.&lt;br /&gt;
&lt;br /&gt;
Display first_value, second_value and sum_of_values.&lt;br /&gt;
&lt;br /&gt;
An explanation of this sample program follows the program.&lt;br /&gt;
&lt;br /&gt;
A SAMPLE C++ PROGRAM&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt; iostream &amp;gt; // spaces are not allowed between &amp;lt; and &amp;gt; &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
// Define the variables first_value, second_value and sum_of_values as integers&lt;br /&gt;
&lt;br /&gt;
int first_value, second_value, sum_of_values;&lt;br /&gt;
&lt;br /&gt;
//Display the phrase &quot;Summation of Integers&quot; on the monitor.&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Summation of Integers&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
// &#39;endl&#39; means it is the end of the line.&lt;br /&gt;
&lt;br /&gt;
//Prompt the user to enter the first integer&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Enter first integer: &quot;;&lt;br /&gt;
&lt;br /&gt;
//Read the first integer (from the keyboard) and&lt;br /&gt;
&lt;br /&gt;
//place it in the memory location named first_ value&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; first_value;&lt;br /&gt;
&lt;br /&gt;
//Prompt the user to enter the second integer&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;Enter second integer&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
//Read the second integer and place it in the memory location named second_value&lt;br /&gt;
&lt;br /&gt;
cin &amp;gt;&amp;gt; second_value;&lt;br /&gt;
&lt;br /&gt;
// Add first_value and second_value&lt;br /&gt;
&lt;br /&gt;
// and store the result in sum_of_values.&lt;br /&gt;
&lt;br /&gt;
sum_of_values = first_value + second_value;&lt;br /&gt;
&lt;br /&gt;
// Display the phrase &quot;first_integer = &quot; and the value of the first integer.&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;first integer = &quot; &amp;lt;&amp;lt; first_value &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
// Display the phrase &quot;second_integer = &quot; and the value of the second integer.&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot;second_integer = &quot; &amp;lt;&amp;lt; second_value &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
// Display the phrase &quot; first integer + second integer = &quot; and the sum of the two integers.&lt;br /&gt;
&lt;br /&gt;
cout &amp;lt;&amp;lt; &quot; first integer + second integer = &quot; &amp;lt;&amp;lt; sum_of_values &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
// Our program returns a value of zero.&lt;br /&gt;
&lt;br /&gt;
return 0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;span lang=&quot;ZH-CN&quot; style=&quot;font-family: SimSun;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span lang=&quot;ZH-CN&quot; style=&quot;font-family: SimSun;&quot;&gt;&lt;/span&gt;References:&lt;br /&gt;
&lt;br /&gt;
I have a Bachelor of Science degree in Electrical Engineering and worked as an embedded systems software engineer.&lt;br /&gt;
&lt;br /&gt;
&quot;The Complete Reference C++&quot; Fourth edition ISBN 0-07-222680-3&lt;br /&gt;
&lt;br /&gt;
My experience as an embedded systems software engineer designing and testing C++ applications.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;&lt;span lang=&quot;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/5596884544138223661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/5596884544138223661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5596884544138223661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/5596884544138223661'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/introduction-to-c-programming-language.html' title='INTRODUCTION TO THE C++ PROGRAMMING LANGUAGE'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-7466175770578500978</id><published>2012-01-13T01:29:00.000-08:00</published><updated>2012-01-13T02:16:13.628-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="address"/><category scheme="http://www.blogger.com/atom/ns#" term="computer"/><category scheme="http://www.blogger.com/atom/ns#" term="memory"/><title type='text'>How Your Conputer Uses Memory</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I originally published this article on Yahoo Voices under the pen name John Mario.&lt;br /&gt;
&lt;br /&gt;
Most new computer has several gigabytes of memory. A gigabyte is 1,000,000,000 bytes. This article talks about how your computer keep track of where everything is stored in this memory. You don&#39;t need a background in electronics to read this article. It is an article for those who want to learn about computer memory without getting buried in a myriad of complicated technical terms.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s digress for a moment. Each family that lives on any given street has a door number on their front door. That door number, as you well know, is part of your address.&lt;br /&gt;
&lt;br /&gt;
Every memory location has an address associated with it. For purposes of this discussion, a memory location is defined as one byte of memory. A byte can hold an 8 digit binary number. In decimal, this means a byte can hold any number from 0 to 255.&lt;br /&gt;
&lt;br /&gt;
When the computer program wants to write data to memory, it accesses memory via the memory address. As you learned in my article on programming, the programmer assigns a name to a memory location. The name describes what is in that memory location. That name is associated with a memory address. Lets assume the name is price_of_apple and the memory address is 36125. Now we write an instruction in our program to save the value 0.95 in the memory named price_of_apple. When that instruction is executed, the memory location with the address 16125 will contain the value 0.95. The English explanation would be that an apple costs $0.95.&lt;br /&gt;
&lt;br /&gt;
Lets take a closer look at what is happening inside your computer without getting buried in mounds of technical jargon:&lt;br /&gt;
&lt;br /&gt;
Basically there are two different types of memory: sequential access and random access. In sequential access memory, you must read everything that is in memory in the order that the data appears until you find the data you are looking for.&lt;br /&gt;
&lt;br /&gt;
In random access memory, you can read any memory locations you want without having to read the other locations. This article will focus on random access memory.&lt;br /&gt;
&lt;br /&gt;
A memory stick inside my HP computer looks like a thin rectangular piece of plastic with multiple pins on one edge. Inside my computer is an Intel computer chip. This Intel chip is referred to as a processor. When the computer program wants to store the price of an apple in memory, the processor sends that price, 0.95, to the memory stick. The processor also sends the address 36125 to the memory stick. Then the processor sends a command to the memory stick telling it to save the price at the memory address. Hence the price is written to the memory location whose address was sent by the processor.&lt;br /&gt;
&lt;br /&gt;
Now let&#39;s talk about reading a memory location. When the computer program wants to read the price of an apple, the processor sends the address (36125) of the memory location price_of_apple to the memory stick. Then the processor commands the memory stick to send the price back to the processor. The memory stick sends the price (0.95) to the processor.&lt;br /&gt;
&lt;br /&gt;
This concludes the explanation of how your computer uses memory.&lt;br /&gt;
&lt;br /&gt;
References&lt;br /&gt;
&lt;br /&gt;
I have a Bachelor of Science degree in Electrical Engineering and worked as an embedded systems software engineer.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/7466175770578500978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/7466175770578500978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/7466175770578500978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/7466175770578500978'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/how-your-conputer-uses-memory.html' title='How Your Conputer Uses Memory'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6966849264975625098.post-4638886586953932003</id><published>2012-01-13T01:23:00.000-08:00</published><updated>2012-01-13T02:17:27.365-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer programming"/><category scheme="http://www.blogger.com/atom/ns#" term="else"/><category scheme="http://www.blogger.com/atom/ns#" term="for"/><category scheme="http://www.blogger.com/atom/ns#" term="if"/><category scheme="http://www.blogger.com/atom/ns#" term="input"/><category scheme="http://www.blogger.com/atom/ns#" term="print"/><category scheme="http://www.blogger.com/atom/ns#" term="while"/><title type='text'>A Generic Introduction To Computer Programming</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I&amp;nbsp;originally published this article on Yahoo Voices under the pen name John Mario.&lt;br /&gt;
&lt;br /&gt;
This article does not focus on any particular computer language. It introduces computer programming by explaining some of the programming instructions that exist in all computer languages. It is directed toward those who are curious about computer programming, but have not yet decided to devote time and money to it.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Computer Programming is the art of using a set of instructions to force the computer to perform a certain task. The programming instructions described in this article will be written in plain english.&lt;br /&gt;
The following computer language instructions will be explained in this article:&lt;br /&gt;
&lt;br /&gt;
The assignment statement&lt;br /&gt;
The PRINT instruction&lt;br /&gt;
The IF instruction&lt;br /&gt;
The ELSE instruction&lt;br /&gt;
The INPUT instruction&lt;br /&gt;
The WHILE instruction&lt;br /&gt;
The FOR loop&lt;br /&gt;
Instructions that perform math operations.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;The Assignment statement&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
Any computer program needs to store temporary data provided by the programmer in memory. The programmer simply provides a name for the data being stored and the value of that data. The programmer does not have to know the exact memory location. The program automatically takes care of that.&lt;br /&gt;
&lt;br /&gt;
For example: If you want to store the price of an apple, you could use the word &lt;i&gt;apple_price&lt;/i&gt; as the name of the memory the price of apples is stored in. Then you store a price in the memory named &lt;i&gt;apple_price&lt;/i&gt;. The instuction would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;apple_price = 0.25&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The statement simply states to store the value 0.25 in the memory named &lt;i&gt;apple_price&lt;/i&gt;. This statement is known as an assignment statement. It assigns a value to the memory named &lt;i&gt;apple_price&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;The PRINT Instruction&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The PRINT instruction can be used to display a value on the monitor. You can use the print instruction to display words, phrases and values.&lt;br /&gt;
&lt;br /&gt;
Here is an instruction that displays the price of an apple.&lt;br /&gt;
&lt;i&gt;print apple_price&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Different languages will have different rules for typing the PRINT instruction. Some languages demand a set of parenthesis around the value to be printed.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;print (apple_price)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
You could also use the print statement to print a phrase. The instruction&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;print &quot;Hello world!&quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
will display the message &lt;i&gt;Hello world!&lt;/i&gt; on the monitor.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;The IF Instruction&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The IF instuction tells the computer when a specific action should be performed. For example, we want the computer to print the price of an apple if the price was less than one dollar:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;If apple_price is less then 1.00, print apple_price.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The way to type &lt;i&gt;less than&lt;/i&gt; is different for different languages.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;The ELSE statement&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
The ELSE statement is part of the IF statement.&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;if apple-price is less than a quarter, then buy apples, else don&#39;t buy apples&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;The INPUT Instruction&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
The INPUT instruction tells the computer to read a value from a particular input. For purposes of this article, that input will be the keyboard. Not all programming languages name this instruction INPUT. The input instruction defines where it wants the input to be stored. For example&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;apple_price = input&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
tells the computer to input a value from the keyboard and store it in the memory named &lt;i&gt;apple_price&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;The WHILE Instruction&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The while instruction commands the computer to keep doing something as long as specified condition exists. Here is a real life example of the WHILE instruction:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;while tornado is near, stay in cellar&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;The FOR Instruction&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The FOR instruction is used to repeat a something a specific number of times. The FOR instruction uses a counter to count the number of times the action is performed. Suppose we wanted to print &lt;i&gt;apple_price&lt;/i&gt; five times. We would create a new memory name &lt;i&gt;index&lt;/i&gt; to use as a counter&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
For example&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;For index = 0 to 4, print apple_price&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
This instruction will set the value of &lt;i&gt;index&lt;/i&gt; to 0 and prints the price of an apple, then it sets the value of &lt;i&gt;index&lt;/i&gt; to 1 and prints the price of an apple. It increments the value of &lt;i&gt;index&lt;/i&gt; and prints the price of an apple again. When the value of &lt;i&gt;index&lt;/i&gt; is greater than 4, it stops printing the price of an apple. Hence, the price of an apple is printed five times: once for each value of &lt;i&gt;index&lt;/i&gt; between 0 and 4.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Math&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
Math statements are also allowed in all programming languages. For example;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;number_of_apples = 5&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;number_of_oranges = 3&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;total_number_of_fruit = number_of_apples + number_of_oranges&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The memory named total will contain the sum of 5 and 3. Note that in this example, we wrote a short program containing three instructions. The first instruction sets the &lt;i&gt;number_of_apples&lt;/i&gt; to 5&lt;i&gt;.&lt;/i&gt; The second instruction sets the &lt;i&gt;number_of_oranges&lt;/i&gt; to 3. The third instruction adds the &lt;i&gt;number_of apples&lt;/i&gt; and the &lt;i&gt;number_of_oranges&lt;/i&gt; to obtain the &lt;i&gt;total_number_of_fruit.&lt;/i&gt; If we added an instruction to print the &lt;i&gt;total_number_of_fruit&lt;/i&gt;, our program would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;number_of_apples = 5&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;number_of_oranges = 3&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;total_number_of_fruit = number_of_apples + number_of_oranges&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;print &lt;/i&gt;&lt;i&gt;total_number_of_fruit&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
References:  &lt;br /&gt;
&lt;br /&gt;
I have a Bachelor of Science degree in Electrical Engineering and I worked as an Embedded Systems Software Engineer. I designed and modified programs in several assembly languages and two high level languages.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnsprogrammingtutorials.blogspot.com/feeds/4638886586953932003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6966849264975625098/4638886586953932003' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/4638886586953932003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6966849264975625098/posts/default/4638886586953932003'/><link rel='alternate' type='text/html' href='http://johnsprogrammingtutorials.blogspot.com/2012/01/generic-introduction-to-computer.html' title='A Generic Introduction To Computer Programming'/><author><name>johnmariow</name><uri>http://www.blogger.com/profile/15870470634745666464</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>