Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Skills and Concepts to Program in C++

0.00/5 (No votes)
7 May 2003 1  
Learn the Skills and Concepts to Program in C++ for Beginner & Intermediate/step by step

Day 1: Getting Started

Today You Will Learn

  • Why C++ is the emerging standard in software development
  • The step to develop a C++ program
  • How to enter, compile, and link your first working C++ program

A Brief History of C++

Computer languages have undergone dramatic evolution since the first electronic computers were built to assist in artillery trajectory calculations during World War II. Early on, programmers worked with the most primitive computer instructions: machine language. These instructions were represented by long strings of one and zeros, assemblers were invented to map machine instructions to human-readable and -manageable mnemonics, such as ADD and MOV. In time, higher-level languages evolved, such as BASIC and COBOL. Some languages, such as Microsoft Visual Basic, call the interpreter the runtime library. Java calls its runtime interpreter a Virtual Machine (VM), but in this case VM is provided by the browser (Such as Internet Explorer or Netscape). C++ calls interpreter translates a program as it reads it, turning the program instructions, or code, directly into actions. A compiler translates the code into intermediary form. This step is called compiling, and it produces an object file. The compiler then invokes a linker, which turns the object file into an executable program.

Solving Problems

The problems programmers are asked to solve today are totally different from the problems that programmers were solving twenty years ago. In the 1980s, programs were created to manage large amounts of raw data. The people writing the code and the people using the program were all computer professionals. Today, computers are in use by far more people, and most know very little about how computers and programs work.

Your First C++ Program : "Hello World"

Traditional programming begins by writing the words "Hello World" to the screen, or a variation on that statement.

Building the Hello World Project

To create and test the Hello World program, follow these steps:

  1. Start the compiler.
  2. Choose File, New from the menus.
  3. Choose Win32 Console Application and enter a project name, such as Example 1, and click OK.
  4. Choose An Empty Project from the menu of choices and click OK.
  5. Choose File, New from the menus.
  6. Choose C++ source file and name it ex1.
  7. Enter the code as showing "Listing 1.1".
  8. Choose Build, Build Example1.exe.
  9. Check that you have no build errors.
  10. Press Control+F5 to run the program.
  11. Press the Spacebar to end the program.

Note: As you prepare for your first C++ program, you will need a few things: a compiler, an editor such as Microsoft Visual C++.

//Listing 1.1
#include <iostream>

int main()
{
       std::cout << "Hello World!\n";
       return 0;
}

History

  • 8th May, 2003: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here