Google

Wednesday, January 6, 2010

CSC202 & ENG4033M: Hello World Program

How To Write a Hello World program

1. Create a New Project called HelloWorld.

2. Right-click the Source File folder.

3. You will see a Context Menu (Pop-Up Menu).
Click on Add\New Item...

4. You will see a Add New Item dialog box.
Select Code\C++File(.cpp)
Give a name to the file, eg. main, then click Add button

At this point, you should see the following:



Type in the source code as shown outlined in red below:




Text format
(just copy and paste into your Visual C++ 2008):


#include "stdio.h"

int main()
{
printf("Hello World\n");
return 0;
}

5. Then, to build your program.
From the Menu Bar, select Build\Build Solution.
In the Output window at the bottom of the screen,
if you see any error, click on the error message
to go to the line which contains the error.



Correct the error, corrected line should be:

printf("Hello World\n");


then Build again.

6. Once you have successfully built the program, you can Test it.
From the Menu Bar, select either Debug\Start Debugging OR,
select Debug\Start Without Debugging.

Program output: