<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>c</title>
<link>http://www.computersight.com/tags/c</link>
<description>New posts about c</description>
<item>
<title>The Worlds Greatest Program, Hello World!</title>
<link>http://www.computersight.com/Software/The-Worlds-Greatest-Program-Hello-World.403511</link>
<description>
<![CDATA[<p>"Hello World!", this program is written in every language as one of the most basic programs so almost all beginners can do it, I will show it in C++.</p>
<p>Here is it dissected, "//" means the rest of that line is commented out so the compiler doesn't see it /* */ comments out all the code in between them</p>
<p>#include // #includes, does as it says it includes the file in the "&amp;lt; &amp;gt;". The file 'iostream.h' aka Input Output stream is need for the further lines of code</p>
<p>using namespace std;// basically a way to type less, it includes the namespace, basically a library of functions. With out this you would need to write std::cout instead of cout</p>
<p>int main()// starts the main function, this is where all C++ programs start</p>
<p>{// shows the start of a function</p>
<p>cout &amp;lt;&amp;lt; Hello World! &amp;lt;&amp;lt; endl;// Cout aka Computer Output, is a simply writes to the console, it write what is after the &amp;lt;&amp;lt;, if its next it needs to be in  a "". (endl simply ends the line)</p>
<p>return 0;//simply exits out of the function with the return value of 0</p>
<p>} // shows the end of a function</p>
<p>/*</p>
<p>depending on your compiler the program may open and close so fast that you don't see it, to fix this add</p>
<p>"#include " to the top of the file and "system("PAUSE");" one the line before "return 0;"</p>
<p>this will stop the program from cloding till you hit a key */</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FSoftware%2FThe-Worlds-Greatest-Program-Hello-World.403511"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FSoftware%2FThe-Worlds-Greatest-Program-Hello-World.403511" border="0"/></a>]]></description>
<pubDate>Fri, 19 Dec 2008 01:46:26 PST</pubDate></item>
<item>
<title>C# Public Variables</title>
<link>http://www.computersight.com/Programming/C++/C-Public-Variables.368515</link>
<description>
<![CDATA[<p>Have you ever wanted to have a variable available on another form than the one you declared it in?</p>
<p>You can use this if you have different buttons to show different things and don't want to make a new form for each.</p>
<p>Start off with your buttons. For this tutorial, I'm going to use 3 buttons and a form that shows the button text.</p>
<p>First to declare your public variable use this:</p>
<blockquote>
<p><strong>public static string pvar;</strong></p>
</blockquote>
<p>This declares the variable as public.</p>
<p>Next, put this under each of your buttons' click events. Edit the bart in Bold to your Button's name.</p>
<blockquote>
<p>pvar = <strong>Button1</strong>.Text;</p>
<p>Form f2 = new Form2();</p>
<p>f2.Show()</p>
</blockquote>
<p>Next, open up your Form2 and add this under the load event</p>
<blockquote>
<p>label1.Text = Form1.pvar;</p>
</blockquote>
<p>This requires a label on Form2 to show the text of the variable.</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FC%2B%2B%2FC-Public-Variables.368515"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FC%2B%2B%2FC-Public-Variables.368515" border="0"/></a>]]></description>
<pubDate>Sat, 29 Nov 2008 03:50:10 PST</pubDate></item>
<item>
<title>Lets Learn C : Printing Strings on to the Screen</title>
<link>http://www.computersight.com/Programming/Lets-Learn-C--Printing-Strings-on-to-the-Screen.225265</link>
<description>
<![CDATA[<p>Here is the first article of my tutorial set. I aim to teach you the basics of C. In this first lesson, I am going to teach you how to output a series of strings on to terminal screen of C program.</p>
<p>Virtually every program code has inputs and outputs. Before compiling a source code, programs generally request an input from the user and then output it to the screen after compiling if the program is well designed and there is no error inside it. Usually, as the program becomes more complicated, error possibility increases. A good software expert easily realizes where the code has faults and corrects it. Since our first code will be very small and very simple, we will not face with any error.</p>
<p>Before starting to write code, we initially have a compiler which is going to evaluate our code. I use Dev C for this. There are many other compilers which run on different platforms like Unix, Linux and Windows.</p>
<p>In this project, we will output the names of  the subprograms of Triond on to C terminal screen. This is the simplest algorithm since there is no input in this example. Let's start writing our code step by step.</p>
<p>Step 1: Open the File from the menu bar of C software and save as the blank page Project1. This yields a file with an extension of cpp.</p>
<p>Step 2: Describe the name and aim of the programs. To do so, we use comments. Comments are ignored by the compiler. For commenting, we use some special scripts like double slash  or  slash-asterisk character .</p>
<p>If we use a single line comment, double slash is enough. However, if our comment is placed more than one line, we use double slash for each line or take the commented part between  slash-asterisk and asterisk-slash characters .</p>
<p>Step 3:  C needs library files which define what the input and output functions are and what they do when they are used in a code. Iostream is the library file of input and output function.</p>
<p>Before the name of library files, we use a special character,  preprocessor directive character. Include is used before the name of every library file and such file names are placed mathematical comparison characters.</p>
<p>Step 4:  Every C code uses functions. The default function is main. Main function is the first function compiled by the programs. This function usually calls other functions. Before the name of function, we specify which type of output our code returns. In our program, we think that it returns to integer and use int. After the function name, we use parantheses. In this example, there will be nothing between parantheses but in more complicated programs, there may be parameter names and it's types or definitions. We place our statements between left brace  and  right brace.</p>
<p>Step 5:  To print on to the screen,we use cout function. We simply place our string inside  double quote  characters. Every statement inside the functions ends with a special semicolon character.</p>
<p>Step 6:  To check the validity, we use return function.In this simple example, it returns to 0.</p>
<p><a href="http://clesson1.blogspot.com/" target="_blank">Click here for the code</a></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FLets-Learn-C--Printing-Strings-on-to-the-Screen.225265"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FLets-Learn-C--Printing-Strings-on-to-the-Screen.225265" border="0"/></a>]]></description>
<pubDate>Sun, 24 Aug 2008 10:02:41 PST</pubDate></item>
<item>
<title>PHP Tutorial: Printing on the Screen</title>
<link>http://www.computersight.com/Programming/PHP/PHP-Tutorial-Printing-on-the-Screen.112786</link>
<description>
<![CDATA[<p>PHP is a script language commonly used by webmasters to design dynamic websites. Unlike HTML which has static content, PHP has dynamic content because of user interaction. Today, most of the qualified websites are designed by PHP or CGI.</p>
 
<p>PHP scripts embedded into the HTML codes. When someone checks the source code of the page, he doesn't get anything about PHP scripts. He only learns the HTML part of coding. This article is an introduction to PHP scripting language. One can find useful information and have enough knowledge after reading my PHP tutorial series. Without delay, I would like to start my script creation step by step.</p>
 
<p>Before starting, you should know that you have to set up PHP installations into your computer. Such installations are PHP itself, Phpmyadmin interface, Mysql database and Apache Server. Without these, your scripts are nothing since they are not compiled by your computer.</p>
 
<h3>Step 1:</h3>
 
<p>To write PHP scripts, we need a place. That place is a simple text editor. You are free to choose your text editor. I prefer  to use Notepad. There are other alternatives like Editplus or Elfima. If your operating system is not Windows but Linux, you can place your code into Vi editor or Pico. I have never tried but I think you can use Dreamveawer, Hotdog or Frontpage.</p>
 
<p>In your text editor, open an new file and save it as &amp;ldquo;myfirst.php&amp;rdquo; or &amp;ldquo;myfirst.html&amp;rdquo; . I choose the name of file as &amp;ldquo;myfirst&amp;rdquo; but you are free to choose anything.</p>
 
<h3>Step 2:</h3>
 
<p>I have told you before that PHP scripts are embedded into HTML codes. So, first of all we will write HTML codes. The basic codes are HTML, TITLE, HEAD and BODY. It can be written by lowercase letters as well. This part is not important.</p>
 
<p><img src="http://images.stanzapub.com/readers/computersight/2008/04/22/149028_0.jpg" alt="" /></p>
 
<p><strong>Step 3: </strong>All PHP scripts start with &amp;ldquo;  &amp;rdquo;. Only the part between two  is compiled by server and evaluated as output.To print characters on the screen, standart output functions of PHP are used. Those are &amp;ldquo; print &amp;rdquo; and &amp;ldquo; echo &amp;rdquo;. In some circumstances, &amp;rdquo; printf &amp;rdquo; is used too.</p>
 
<p>The format of printing:</p>
 <ol> 
<li> print  ( &amp;ldquo; your output &amp;rdquo; ) ;</li>
 
<li> print   &amp;ldquo; your output &amp;rdquo;  ;</li>
 
<li> echo &amp;ldquo; your output &amp;rdquo;  ;</li>
 
<li> echo ( &amp;ldquo; your outpu t&amp;rdquo; ) ; </li>
 </ol> 
<p>If you don't use any white space characters, the strings are written without any separation. For example if you write this code;</p>
 
<ul>
<li>Print ( &amp;ldquo; Word1 &amp;rdquo; ) ;</li>
 
<li>Print ( &amp;ldquo; Word2 &amp;rdquo; ) ;</li>
 
</ul>
<p>It will be outputted as Word1Word2.</p>
 
<p>To remove this fault,white space characters are used. In PHP code part, between print functions, we place &amp;lt; br &amp;gt; code.</p>
 
<p>Example: To be more understandable,I will write a simple PHP script. Output will be the name of my favorite Triond writers.</p>
 
<p><img src="http://images.stanzapub.com/readers/computersight/2008/04/22/149028_1.jpg" alt="" /></p>
 
<p>To see the output,<a href="http://learnphp.awardspace.biz/" target="_blank"> Click here.</a></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FPHP-Tutorial-Printing-on-the-Screen.112786"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FPHP-Tutorial-Printing-on-the-Screen.112786" border="0"/></a>]]></description>
<pubDate>Tue, 22 Apr 2008 06:42:32 PST</pubDate></item>
<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>
</channel>
</rss>
