<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>compilers</title>
<link>http://www.computersight.com/tags/compilers</link>
<description>New posts about compilers</description>
<item>
<title>Message Boxes in C++</title>
<link>http://www.computersight.com/Programming/C++/Message-Boxes-in-C.39895</link>
<description>
<![CDATA[<p><strong>Note:</strong> The following is for people who already know C++.</p>

 <p> In case you don't know what message boxes are, here are some examples:</p>
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_0.jpg" /></p>
 
 <H3>There are only two things needed to create Message Boxes:</H3>

<P><OL> <li> Include the “windows.h” library: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_1.jpg" /></LI>
 <li> Use this function :  <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_2.jpg" /> </LI></OL></P>
 
 <H3>So, here is the complete code to generate a message box:</H3>

 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_3.jpg" /></p>

 <H3>The above code generates this message box:</H3>

 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_4.jpg" /></p>

 
 <p>Simple… right? But what does the “MB_OK” mean? All it does is tell the Message Box to make a button that says “OK.” You can make the button on the Message Box say different things.</P>
 <H3> Here is the complete list:</H3>
<P><UL><LI>MB_ABORTRETRYIGNORE</LI>
 <LI>MB_CANCELTRYCONTINUE</LI>
 <LI>MB_HELP</LI>
 <LI>MB_OK</LI>
 <LI>MB_OKCANCEL</LI>
 <LI>MB_RETRYCANCEL</LI>
 <LI>MB_YESNO</IL>
 <LI>MB_YESNOCANCEL</IL></UL></P>

 <p>	Go ahead! Try them! Replace the part in the code that say “MB_OK” with any of these and see what you get! Try them all!</p>


 <p>Ok, so now you know how to make buttons. But what about the icons like these?: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_5.jpg" />? To make them, you add any of these:</p>
 <P><UL><LI>MB_ICONEXCLAMATION: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_6.jpg" /></LI>
 <LI>MB_ICONWARNING: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_7.jpg" /></LI>
 <LI>MB_ICONINFORMATION: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_8.jpg" /></LI>
 <LI>MB_ICONASTERISK: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_9.jpg" /></LI>
 <LI>MB_ICONQUESTION: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_10.jpg" /></LI>
 <LI>MB_ICONSTOP: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_11.jpg" /></LI>
 <LI>MB_ICONERROR: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_12.jpg" /></LI>
 <LI>MB_ICONHAND: <img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_13.jpg" /></LI></UL></P>

 <H3>Here is an example of a Message Box with icons:></H3>

 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_14.jpg" /></p>


 <H3>The above code generates this Message Box:</H3>

 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_15.jpg" /></p>
 
 <p>But what if you want to make a combination of buttons with icons? What if you want MB_YESNO as the button and MB_ICONERROR as the icon? The answer is simple, you would use “MB_YESNO | MB_ICONERROR”. </P>
 <H3>Here is an example:</H3>

 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_16.jpg" /></p>

 <H3>The above code generates the following Message Box:</H3>

 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_17.jpg" /></p>

 
 <p>Yay, now you know how to create Message Boxes but how do you know if they press a button in the Message Box?</P>
 <H3> Here is an example of how you check:</H3>
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/34080_18.jpg" /></p>

 <p>As you can see, the code Checks if you clicked the button yes (shown as IDYES) and writes “you pressed yes.” If you clicked no, it writes “you pressed no.” here is the list of the possible buttons.</p>
 <P><UL><LI>IDABORT:      Checks if you pressed the button “Abort”</LI>
 <LI>IDCANCEL:     Checks if you pressed the button “Cancel”</IL>
 <LI>IDCONTINUE:	 Checks if you pressed the button “Continue”</LI>
 <LI>IDIGNORE:   Checks if you pressed the button “ignore”</LI>
 <LI>IDNO:               (Checks if you pressed the button “No”</LI>
 <LI>IDOK:	   Checks if you pressed the button “OK”</LI>
 <LI>IDRETRY:    Checks if you pressed the button “Retry”</LI>
 <LI>IDTRYAGAIN:	  Checks if you pressed the button “Try Again”</LI>
 <LI>IDYES:	   Checks if you pressed the button “Yes”</LI></UL></P>
 
 <p>Yay, you are now an expert with using Message Boxes. I hope you liked this tutorial!</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FC%2B%2B%2FMessage-Boxes-in-C.39895"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FC%2B%2B%2FMessage-Boxes-in-C.39895" border="0"/></a>]]></description>
<pubDate>Sat, 02 Jun 2007 05:02:13 PST</pubDate></item>
<item>
<title>C++ Tutorial One</title>
<link>http://www.computersight.com/Programming/C++/C-Tutorial-One.39840</link>
<description>
<![CDATA[<p>Welcome to my first C++ tutorial!</p>
 
 <p>This tutorial will teach you the very basics of programming in C++.  </p>
 
 <p>So, what <strong>are</strong> the very basics of C++? In this tutorial, you will learn input and output.</p>
 
 <p>Input is when you give information to the computer. An example is when you move your computer mouse. If you move it to the left, you are telling the computer to move the clicker on the screen to the left.</p>
 
 <p>Output is when the computer gives information to you. The computer is always outputting information to you. Examples are text, pictures, videos, or music. You get the point...</p>
 
 
<h3>NOW WE START PROGRAMMING!</h3>


        
<h3>Input:</h3>

 
 <p><ul>
  <li> First download DevCpp (http://www.bloodshed.net/dev/devcpp.html).  </li>
 
  <li> It should look like this:  </li>
 </ul></p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_0.jpg" /></p>
 
 <p><ul>
  <li> Now go to: File/New/Source File.  </li>
 
  <li> Write this in the text area:  </li>
 </ul></p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_1.jpg" /></p>
 
 <p><ul>
  <li> Go to: Execute/Compile and Run.  </li>
 
  <li> Save the file wherever you want.  </li>
 
  <li> Wait a while until the program compiles  </li>
 
  <li> You should get something like this:  </li>
 </ul></p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_2.jpg" /></p>
 
 
 <p>At first sight, the code looks very intimidating, but it's not complicated. If we take off all the comments, it looks like this:</p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_3.jpg" /></p>
 
 <p>That isn't that bad... Right? But what does it mean?</p>
 
 <p>The first two lines are libraries. A library is already-made code that makes it easier for us to program. Using libraries lets us program with very little code. If we didn't use libraries, it would take 50 more times of code to program.</p>
 
 <p>The fifth line is where the main code goes. Just imagine it like this:</p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_4.jpg" /></p>
 
 <p>The seventh line prints out “hello world” onto the screen. This code uses the first library (<img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_5.jpg" />) and would not work without it.</p>
 
 <p>The eighth line waits for any key to be pressed and the program doesn't do anything until a key is pressed. This code uses the second library (<img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_6.jpg" />) and would not work without it.</p>
 
 <p>The ninth line ends the program.</p>
 
 
 
 <p>So, now that you learned output, it's time to learn input.</p>



<h3>Output:</h3>

 
 <p><ul>
  <li> Replace the first program with:  </li>
 </ul></p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_7.jpg" /></p>
 
 <p><ul>
  <li> Go to: Execute/Compile.  </li>
 
  <li> Wait a while until the program compiles.  </li>
 
  <li> It should look something like this:  </li>
 </ul></p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_8.jpg" /></p>
 
 <p>Since you already know what most of the program does, I will just explain the new parts added.</p>
 
 <p>The seventh line declares a variable “number”. This variable is declared as an integer and it can be used to store any integer value like 3, 1024, 4, -56, -93, or -1000.</p>
 
 <p>The ninth line waits for you to type in any integer and waits for you to press enter. Whatever integer you type will be stored into the variable “number”.</p>
 
 <p>The tenth line types in the value of “number” and then continues on by saying “is also my favorite number”. The value of “number”, as I said before, will be whatever you typed as your favorite number.</p>

 <p>So let's assume that you said your favorite number was 15. The program would say “15 is also my favorite number!”</p>
 
 <p>That is the end of this tutorial. I hope you learned a lot about input and output. Try messing around with the code and see what you get.</p>
 
 
 <h3>Pop Quiz!</h3>
 
 <p>Write a program that does the following:</p>
 
 <p><img  alt="" src="http://images.stanzapub.com/readers/computersight/2007/08/14/23322_9.jpg" /></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FC%2B%2B%2FC-Tutorial-One.39840"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FC%2B%2B%2FC-Tutorial-One.39840" border="0"/></a>]]></description>
<pubDate>Sun, 01 Apr 2007 08:27:32 PST</pubDate></item>
</channel>
</rss>
