First Lesson in C++ Programming

Author: Ronald S. Holland
Total Application Works

To visit my site

HOME Consulting Design Maintenance Project Testing Training Turnkey Java C++ SQL HTML JavaScript

To contact us

© 2002 - 2015 All Rights Reserved Total Application Works

  • Tell a friend about this site (copy and paste the following HTML page into a file (e.g., using Notepad).)

  • <html>
    <title>Example of a link </title>
    <a href="">
    Getting Started with Visual C++: First Lesson </a>
    Download Source and see a screen shot


This tutorial is intended for that person who is getting started with Microsoft's Visual Studio 2008. In order for you to be able to follow this tutorial, you will need Microsoft's Visual C++ compiler. If you don't have a copy, you can download a free copy at Microsoft's Visual Studio Downloads Page. This download may take approximately 24 hours using a 56 kbps dial-up. You may be able to download a copy in 10-20 minutes, if you have access to a T1 line at a public college or a public library, assuming a line is available. You can follow the steps below:

  1. Download a free copy of VC++ at Microsoft's Visual Studio Downloads Page.
    • This copy is in image file format (ISO images).
    • I used this option: All - Offline Install ISO image file. With this option, you get the following:
      • Visual Basic 2008 Express Edition
      • Visual C# 2008 Express Edition
      • Visual C++ 2008 Express Edition
      • Visual Web Developer 2008 Express Edition
  2. Download a free copy of VCdControlTool. It only works with ISO images. Installation instructions:
    1. Copy VCdRom.sys to your WINDOWS\system32\drivers folder.
    2. Execute VCdControlTool.exe
    3. Click "Driver control"
    4. If the "Install Driver" button is available, click it. Navigate to theWINDOWS\system32\drivers folder, select VCdRom.sys, and click Open.
    5. Click "Start"
    6. Click OK
    7. Click "Add Drive" to add a drive to the drive list. Ensure that the drive added is not a local drive. If it is, continue to click "Add Drive" until an unused drive letter is available.
    8. Select an unused drive letter from the drive list and click "Mount".
    9. Navigate to the image file (VS2008ExpressWithSP1ENUX1504728.iso or VS2010Express1.iso), select it, and click "OK". UNC naming conventions should not be used; however, mapped network drives should be OK.
  3. Next use Windows Explorer to navigate to the Virtual drive you mounted. You will see the following folders:
    • Include
    • VBExpress
    • VCExpress
    • VCSExpress
    • VWDExpress
  4. Use the setup application in each folder to install the desired components.
  5. You are ready to start programming.
  6. You can download other compilers at:
    1. Bloodshed C++
    2. Dev-C++

In this tutorial, we will create a Hello World application, using Microsoft's Visual Studio C++ 2008. We will be briefly describing the C++ language in the next section.

What is the Difference between C and C++?

C is a third generation programming language originally created for the development of the Unix operating system. As a third generation programming language it is considered a low-level yet powerful language. It lacks many modern and useful constructs. C is not an object oriented programming language.

C++ is a an object oriented programming language, that is derived from C. Basically, C++ maintains all aspects of the C language, while providing new features to programmers (e.g., object oriented programming) that make it easier to write reusable and more sophisticated programs. What is an object?

The concept of a class

An object is the instantiation of a class. Let's consider the class of automobile, which contains the set of all automobiles. A sampling might be:

  • Acura TL
  • BMW 5 series
  • Buick Century
  • Ford Explorer
  • Honda Pilot
  • Mazda6
  • Toyota Avalon
  • Toyota Highlander
  • Volvo S60
  • Etc.
If we were to write one of the examples above in C++, it might look like:

class Toyota : automobile {

class Avalon : Toyota {
This example is interpreted as class Avalon inherits from class Toyota and class Toyota inherits from class automobile. Another way of expressing this concept is to say that Toyota is a child of automobile and that Avalon is a child of Toyota.


  1. Create a MS C++ application template.
  2. Use the MS C++ application template to create a Hello world application.

MS C++ Application Template

If you look in a dictionary, template is defined as

    A pattern, usually in the form of a thin plate of metal, wood, plastic, etc., for forming an accurate copy of an object or shape

In C++, a template is a keyword that allows you to create generic functions and/or classes. Java has a keyword interface that is similar, but for our purposes, we will say they are not the same. How does the term template/pattern apply? Remember that a template is a pattern; therefore, the application template for Hello World looks like:


/** **********************************************************************
 * HelloWorld.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[]) {


Where do we go from here? The next step is to use the template to create a Hello World application. In the next section we will take this next step.

Expand Our Template to Create an Hello World Application

In this section, we will the following:

  1. Launch Microsoft's Visual Studio C++ 2008;

  2. Select File --> New --> Project. This will cause the New Project dialog to appear.

    • Select Win32
    • Select Win32 Console Application
    • Name box --> enter HelloWorld where I show FirstProgram
    • Location box --> the folder where the program is to be stored.
    • Press OK
  3. This will cause the Win32 Application Wizard dialog to appear.

    • Press Application Settings
    • Press Console application
    • Press Precompiled header
    • Press Finish
  4. Under #include "stdafx.h", enter
    • #include <iostream>
    • using namespace std;
  5. Enter cout<<"Hello World!";
    Under #include int _tmain(int argc, _TCHAR* argv[]) {
  6. The final result will look like:

  7. To execute or run this program:
    • Select Debug --> Start Without Degugging and you will see the following:

    • cout is an object of class ostream that represents the standard output stream. This object allows the user to write streams to the standard output stream e.g., cout << "Hello World!" << endl;
Congratulations! You have written your first Visual Basic 2008 Express Edition program.



    The child is considered a subclass of a parent class or is derived from a parent class.


    Is the ability to create a class that derives properties from one or more base classes.



  • One kilobit per second (Kbps) equals 1000 bits per second (bps). (Note: Kbps is sometimes also written as �kbps� - both carry the same meaning.)
  • One megabit per second (Mbps) equals 1000 Kbps or one million bps.
  • One gigabit per second (Gbps) equals 1000 Mbps or one million Kbps or one billion bps.


    In the context of object oriented programming the word, "object", refers to a particular instance of a class.

Object oriented

    Object-oriented programming (OOP) is a programming paradigm that uses "objects" � data structures consisting of datafields and methods together with their interactions � to design applications and computer programs.

HOME Consulting Design Maintenance Project Testing Training Turnkey Java C++ SQL HTML JavaScript

© 2002 - 2015 All Rights Reserved Total Application Works