Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book

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.

  • + Share This
  • 🔖 Save To Your Account