Follow these steps to write, save, compile, and run your first program using Mircosoft’s Visual C++ 2010 Express, a popular and free IDE for the Windows platform.
C:\Users\Mike\Desktop\game_over\
.) Last but not least, make sure the check box is checked for Create directory for solution. Your New Project dialog should look similar to the one in Figure A.2.It’s generally a good idea to store each project in its own folder.
Figure A.1 - Visual C++ 2010 Express on startup.
Figure A.2 - The New Project dialog, filled out.
Figure A.3 - The Win32 Application Wizard - Application Settings, defining an empty project.
If the Solution Explorer is not displayed, from the application menu, select View, Other Windows, Solution Explorer.
.cpp
). In the Name field, type game_over.cpp. Check out Figure A.5 for a completed Add New Item dialog image.Figure A.4 - Your newly created project.
Figure A.5 - The Add New Item dialog, filled out.
game_over.cpp
appears, ready for edition. In the game_over.cpp
C++ file, type the following:1
2
3
4
5
6
7
8
9
10
// Game Over
// A first C++ program
#include <iostream>
int main()
{
std::cout << "Game Over!" << std::endl;
return 0;
}
Your screen should look like Figure A.6.
Figure A.6 - Your new C++ file, edited.
Ctrl+F5
to run the project and enjoy the fruits of your labor. You should see the results shown in Figure A.7.Figure A.7 - The big payoff: seeing your program run.
Congratulations! You’ve written, saved, complied, and run your C++ program.
For more detailed information about Mircosoft Visual C++ 2021 Express, please see its documentation.