Você está na página 1de 5

ECE 152 Programming for Engineers

Visual C++ 2012 Tutorial


Step 1: Start the Visual Studio 2012 from the Start Menu\All Programs\Microsoft Visual
Studio 2012.

Step2: Before you begin using Visual Studio 2012 for the first time, you need to choose
Visual C++ Development Settings, and then click Start Visual Studio.

Step3: Create a new project. Every single program must be included in a project. You can
click FILE\New\Project or click New Project in the Start page.

Step4: Setup the Project Type. Click on the Visual C++ option on the left window, and
choose the Win32 Console Application option from Visual Studio installed templates.
Provide a Name for your project (HelloWorld in this example). The Solution Name is
the same as the project name. Choose the desired Location where your project will be saved.
Click OK.

Step5:

In the Win32 Application Wizard, click Application Settings.

Step6: Select Console Application in Application type and check Empty project in
Additional options. Click Finish.

Step7: The Project is created. Right click on the Source Files \Add\New Item to add
new files to your project. In this tutorial, we will add a file called FirstExample.cpp to the
project.

Step8: Select C++ File (.cpp) to add a C++ source file. Provide a file name, i.e.
HelloWorld. Click Add. A file called HelloWorld.cpp will be added to the project.

Step9: Enter the simple Hello World code in HelloWorld.cpp.


#include <iostream>
using namespace std;
int main()
{

cout << "Hello World!";


system("pause");
return 0;
}
Step10: Save the file. Compile and Run your program by clicking on the Debug button
(The green arrow) or press F5 button. You will see a console pop up with the Hello World!
message. Press Enter to close the console window.

The executable file, HelloWorld.exe is under the project path\ the name of the project \
Debug.
Hint: If you are creating a simple project, in Step 4, you can choose Empty Project. If do
that, you can skip Step 5 and Step 6.

Você também pode gostar