Free Hosting

Compiling your first program

Before we will start to develop some programs keep in mind the following two things:-
1.    We are going to develop C++ program so always save the program with .cpp extension.
2.    We will develop console programs means there will be no graphics user interface will be developed to interact with our program(because GUI interface development will go so complex and the basic concept will not be understandable to you).
So now create a new project in Visual Studio by following these steps:-
   New -> Project. A dialog box will pop up that looks like this



 Select the Win32 project type, and Win32 Console Application will automatically be selected for you. In the Name field, you will enter the name of your program. Type in HelloWorld. In the Location field, pick a directory that you would like your project to be placed into. We recommend you place them in a subdirectory off of your C drive, such as C:\VC2005Projects. Click OK, and then Finish.


  On the left side, in the Solution Explorer, Visual Studio has created a number of files for you, including stdafx.h, HelloWorld.cpp, and stdafx.cpp.

  In the text editor, you will see that VC2005 has already created some code for you. Select and delete the _tmain function, and then type/copy the following into your compiler:
#include "stdafx.h"
#include <iostream>

int main()
{
                std::cout << "Hello world!" << std::endl;
           return 0;
}


0 comments:

Blogger Template by Clairvo