Program

Submitted by: Submitted by

Views: 239

Words: 497

Pages: 2

Category: Science and Technology

Date Submitted: 05/09/2012 01:01 PM

Report This Essay

Steps to compile and run a C++ Program

Compiler: Microsoft Visual C++ 6.0

Operating System: Windows

Step 1. Start the Microsoft Visual C++ programming environment by clicking Start, Microsoft Visual Studio, and Microsoft Visual C++.

[pic]

The following is the startup screen for the Visual C++ environment.

[pic]

The icon in the upper left under the File choice is pressed to obtain an editor window.

[pic]

When typing the C++ program source code no elements will be highlighted since the editor treats the source code as a text file at this point.

If you wish the keyword highlighting to be activated you should explicitly save the file as a .cpp file. See the explanation a few pages ahead.

[pic]

After typing the C++ source code it should be saved as a .cpp file. The name should be somewhat original. This does not include lab1.cpp, program1.cpp, or assignment.cpp. The .cpp extension is necessary for the following steps to work correctly since the compiler expects that extension for source files it should compile.

[pic]

[pic]

[pic]

[pic]

[pic]

After making the correction you should build the executable.

[pic]

[pic]

[pic]

[pic]

-----------------------

Click this icon to obtain an editor window to type in your C++ program source.

Editor window. Type your source code here.

Source code for C++ program (taken from "Problem Solving with C++"

Use the File menu item.

Choose a directory to save the source file and other files that Visual C++ creates for you.

Pick a representative file name with the .cpp extension

After choosing the directory and typing in a program name, click on save.

You now need to Build the program to obtain an executable.

Visual C++ requires the program be part of a 'project workspace' and is offering to create one for you.

Click on Yes.

Message window...