Introduction to C++ Programming for Beginners

This is the first of many C++ programming tutorials to come. You can use any Native C++ compiler in this tutorial series, but we will use a free Windows C++ compiler.

In this tutorial, you learn how to download and install Microsoft Visual C++ Express 2010. It is free, and easy to learn. It also offers more than enough features to learn how to program in C++.

You will learn C++ starting with Console applications. A Console application (text input from the keyboard, and text output to the console window), is all you need to get started in C++.

Later we will go into more advanced topics like Object Oriented Programming. Yes, you can learn all this in a Console Project as well.

You will also learn:

  • What a .cpp file is
  • The C++ main function
  • The return 0 in C++
  • The iostream in C++
  • The using namespace std
  • Comments in C++
  • And using cout and cin

So lets get started

Your first program is the simple “Hello World” example:

intmain() {

    cout << "Hello World";

    return 0;

Installing a C++ IDE/Compiler

In your web browser go to In the search, type “c++ express“.

This will bring up a list, the top one usually will be the one your interested in.

On the Express download page, choose Microsoft Visual C++ Express.

The file you download “vc_web” is just a loader.

After downloading the loader, double click “vc_web” to start installing.

The loader will start downloading and installing the files needed for C++ Express.

When the download is complete, you will be asked to register. Register it now or in 30 days you will have to register to keep using C++ Express for free.

Click the Start button and you will see the Microsoft Visual C++ Express title.

Click it and C++ Express boots up.

Now you are ready to start a console project.

Starting a Console App in Visual C++

Open Visual C++. On the Menu, go to Tools/Options.

Click C/C++ then under Display, check “Line numbers”. Line numbers are good, you will find out as you learn C++ in Microsoft.

Lets start a bare bones console application. First, on the Menu, go to File/New/Project.

In the pop up box, choose Win32/Win32 Console Application.

Name your App, in this case we will name it “C++ConsoleApp.” Then click ok.

The Application Wizard box opens.

Before you click Finish, click Next.

Make sure you put a checkmark next to “Empty project.”

Now you can click Finish to create an empty console application.

A bare bones C++ program needs a .cpp file. So under Solution Explorer, right click Source files/Add/New Item.

Choose C++ File (.cpp) and give it a name like MainApp. Then click Add.

Below, you see an empty MainApp.cpp file. It starts at line number 1, but there is no Main function yet. We will add that next.

Type in “int main(){return 0;}

Next, add the <iostream> and namespace std above the main function. Now we can start coding inside the main function.

Your first program – “Hello World”

We will start with a simple “Hello World” program. Not a real App, just a text print to the screen. After you start a console project with an empty main() function, type in the three statements below.

int input_pause;

cout << "Hello World"; 

cin >> input_pause; //press any key and Enter to end program or close console window

To start the program for the first time it has to be Built by the Compiler. You can go to “Build Solution” first, or if you are sure there are no syntax errors, go to “Start debugging“, which will Compile and start the program.

The console window pops up and you see Hello World.

Lets take a closer look at the three statements of interest in this program.

int input_pause;

cout << “Hello World”;

cin >> input_pause;  //press any key & Enter to end program or close console window

The first statement just initializes the variable input_pause

The second statement cout, just prints the text that is in quotations to the screen.

The third is a cin input statement with the variable “input_pause“. All this line does is keep the console window from closing until you enter a key or close the console window.

Comments & Semicolons

Take note that all statements must end in a semicolon ;

cout << "Hello World";

The “slash marks” is a comment and is ignored by the compiler.

cin >> input_pause; //press any key

Next Tutorial

You will start learning the basics of C++ .

You might also want to read:

Part 2 – The Basics of C++

Part 3 – Conditional “if” Statement

Part 4 – else if Statement in C++

Part 5 – “switch and loops”

Part 6 – Arrays & Strings

Part 7 – Pointers

Part 8 – Functions in C++

If you like this page please share with your friends:

Leave a Reply

Your email address will not be published. Required fields are marked *