Overview

Tuesday, 9 July 2013

An Overview of C++


one no element exists in isolation. Rather, the components of the language work together. It is this interrelatedness that makes it difficult to discuss one aspect of C++ without involving another. To help overcome this problem, this chapter provides a brief overview of several core C++ features, including the general form of a C++ program, some simple control statements, variables, and operators. It does not go into too many details, but rather concentrates on the general concepts common to all C++ programs. Most of the topics presented here are examined more closely in later chapters. Since learning is best accomplished by doing, it is recommended that you work through the examples using your computer.

Your First C++ Program


Before getting into any theory, let’s look at a simple C++ program. We will start by
Entering, compiling, and running the following program.
/* Program #1 - A first C++ program.
Enter this program, then compile and run it.
*/
#include < iostream>
using namespace std;
// main () is where program execution begins.
Int main()
{
cout << "This is my first C++ program.";
return 0;
}
You will follow these steps.
1. Enter the program.
2. Compile the program.
3. Execute the program.
Before beginning, it is necessary to define two terms. The first is source code. Source code is the version of your program that humans can read. The preceding listing is an example of source code. The executable version of your program is called object code or executable code. Object code is created by the compiler when it compiles your program.

No comments:

Post a Comment