Tuesday, May 27, 2014

C++ Programming Tutorial ( Part 3 )

Structure of a program

Probably the best way to start learning a programming language is by writing a program. Therefore, here is our
first program:



The first panel shows the source code for our first program. The second one shows the result of the program once



compiled and executed. The way to edit and compile a program depends on the compiler you are using. Depending
on whether it has a Development Interface or not and on its version. Consult the compilers section and the manual
or help included with your compiler if you have doubts on how to compile a C++ console program. 
The previous program is the typical program that programmer apprentices write for the first time, and its result is
the printing on screen of the "Hello World!" sentence. It is one of the simplest programs that can be written in
C++, but it already contains the fundamental components that every C++ program has. We are going to look line
by line at the code we have just written: 
// my first program in C++ 
This is a comment line. All lines beginning with two slash signs (//) are considered comments and do not
have any effect on the behavior of the program. The programmer can use them to include short
explanations or observations within the source code itself. In this case, the line is a brief description of
what our program is.