Blackbound 4 Report post Posted July 9, 2009 Your Basic C++ Program Create a new project by going to File->New->Project. Pick CLR Empty Project and name it as "MyFirstProgram" Once you have that done, you will see on the bar to the left that says "Solution explorer" has the name of your program. Right click on where it says "Source Files" and hit Add->New item and pick "C++ file (.cpp)" and name it Main now copy the below code and put it into the file you just created and we will dissect it piece by piece. #include<iostream> using namespace std; int main(){ cout << "Hello World" << endl; system("pause"); return 0; } before we start dissecting it, lets make sure it works first. Go to Build->Build Solution or hit F7. (It should work, the only reason it might not have worked would be user error) #include<iostream> this includes the file "iostream.h" from the main source library. #include <from library> or #include "from local directory" using namespace std; This tells the compiler we are using the namespace "std" (Which stands for Standard not Sexually Transmitted Desease) int main () { We are opening a function titled Main, It take no arguments and returns an integer. cout << "hello world" <<endl; we are using the standard library function "cout" (pronounced C out) to tell the compiler to display "Hello World" and then start a new line. system("pause"); This tells the system to pause what its doing and wait for user input and displays "Press any key to continue" return 0; This tells the program to return the number 0 as the Main function's ouput } this signifies the end of the main function and should not be forgotton. If you forget this your code will screw up. Share this post Link to post Share on other sites
Tomo2000 60 Report post Posted July 11, 2009 Nice tutorial. Just before I started reading VC++ finished installing so the first thing I tried was this. It worked without any troubles :D . I just have 1 question; What is "iostream.h"? Share this post Link to post Share on other sites
Blackbound 4 Report post Posted July 12, 2009 iostream.h as long hand would be Input Output Stream. This controls the primary functions for basic input and output as the name suggests. Share this post Link to post Share on other sites
Tomo2000 60 Report post Posted July 12, 2009 Ah, ok. That makes sense. Thanks. Share this post Link to post Share on other sites