- Install Microsoft Visual Studio
- Create a Project with Microsoft
- Writing a Program in Microsoft Visual Studio
- Running a Program in Visual Studio
- Compatibility Issue #1: stdafx.h
- Compatibility Issue #2: Pausing the Screen
- If You're Not Using Microsoft
- Advancing to the Next Print Line
- Storing Data: C++ Variables
- Introduction to Data Types
- A Word about Variable Names and Keywords
- Chapter 1 Summary
Writing a Program in Microsoft Visual Studio
Now—again, assuming you’re using Microsoft Visual Studio—you’re ready to write your first program. The previous section showed the skeleton (or boilerplate) that’s already provided. Your task is to insert some new statements.
In the following example, I’ve added the new lines and placed them in bold—so you know exactly what to type:
#include "stdafx.h" #include <iostream> using namespace std; int _tmain(int arg, _TCHAR* argv[]) { cout << "Never fear, C++ is here!"; return 0; }
For now, just leave #include “stdafx.h” and t_main alone, but add new statements where I’ve indicated. These lines are Microsoft specific, and I’ll have more to say about them in the section “Compatibility Issue #1: stdafx.h.” First, however, let’s just run the program.