C++ Programming Using Microsoft
Visual Studio
1. Files of a C++ program. In its simplest form, a C++ program is simply a source code file with the file extension .cpp, in which you have C++ source code defining the main function and maybe other functions. The main function is the starting point of execution when you successfully compile and run the program. In general, a C++ program, in addition to such a single source code file, may have other source code files (with the file extension .cpp), plus some header files (with the file extension .h), and others.
2. Compiling C++ program under Microsoft Visual
Studio.
3. A sample project under Microsoft Visual Studio. For each new program we write, we need to create a project for it in Microsoft Visual Studio, and have all the related files (source code files and header files …) of the program added into the project. Usually we have the C++ source code file(s) and header file(s) of the program together with some project information files stored in a single project folder. For example, consider a very simple C++ program composed of this single main.cpp file only. For this program, here is a Microsoft Visual Studio project folder (compressed as a zipped file). Please download it and use WINZIP to unzip it to get the project folder. Open the folder and double click the sample.sln solution file. This will automatically invokes Microsoft Visual Studio to open the entire project for you. Play with it to get some hands-on experiences.
4. Free Microsoft Visual C++ 2010
Express Edition
5. Other free C++ compiler GNU: There are many other free C++ available on different hardware platforms. Among them, Gnu gcc is a top quality widely used open-source C++ compiler for free.
6. Steps of programming using Microsoft Visual Studio. For the first programming assignment, you can simply make a copy of this entire sample project folder, rename the folder, and then replace the contents of main.cpp with your own code. (See the description at #5 below, if you would like to create a new project for a new program that has multiple source code files and header files in it from scratch by yourself, instead of using and modifying the sample project given in #3.) To finish your programming assignment, you may repeatedly do the following things with the project under Microsoft Visual Studio:
7. Create a new project for a new C++ program from scratch. You can always make a copy a solution project folder and change its contents for a new programming assignment. Instead of reusing the sample project I gave you, you can also create from scratch a new project for a new C++ program, which may have multiple source code files and header files in it, in the following way