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++. The following is the startup screen for the Visual C++ environment. 1 This window is the editor window when the editor is active. This window is the 'class' window when working on a project. This window is for messages from the compiler/loader, especially error messages for typographical errors. The icon in the upper left under the File choice is pressed to obtain an editor window. Click this icon to obtain an editor window to type in your C++ program source. 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. 2 Editor window. Type your source code here. 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. 3 Use the File menu item. Use the SaveAs option to save the file Source code for C++ program (taken from "Problem Solving with C++" 4 Choose a directory to save the source file and other files that Visual C++ creates for you. After choosing the directory and typing in a program name, click on save. Pick a representative file name with the .cpp extension 5 You now need to Build the program to obtain an executable. 6 Visual C++ requires the program be part of a 'project workspace' and is offering to create one for you. Click on Yes. 7 Improperly spelled keyword causes the error message displayed below. It should be 'char'. The class window in populated now that a project is underway. Message window for Visual C++. The compiler is complaining here about a misspelled keyword. Use the editor to correct the typing mistake. After making the correction you should build the executable. 8 Use the Build option on the menu to create the executable. As you can see additional menu choices are available now that the program is part of a project. 9 For a successful build no errors should be found by the compiler or the linker. You can now execute the program. 10 Under the Build menu is an Execute option. 11 The program will execute in its own window. The numbers for the number of pods and peas in the pod were entered and the program printed the information. To return to the Visual C++ environment press a key and the execution window will disappear. 12