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:
- Start the compiler.
- Choose File, New from the menus.
- Choose Win32 Console Application and enter a project name, such as Example 1, and click OK.
- Choose An Empty Project from the menu of choices and click OK.
- Choose File, New from the menus.
- Choose C++ source file and name it ex1.
- Enter the code as showing "Listing 1.1".
- Choose Build, Build Example1.exe.
- Check that you have no build errors.
- Press Control+F5 to run the program.
- 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++.
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
History
- 8th May, 2003: Initial post