STRUCTURE OF PROGRAM (PART 2)

Posted on at


STRUCTURE OF PROGRAM (PART 2)

We are going to look lines by lines at the codes we have just written:


// my first program in C++
This is a comment lines. All lines beginning with two slash signs (//) are considered comment and do not
have any effects on the behavior of the programs. The programmer can use them to includes short
explanation or observations within the source code itself. In this cases, the line is a brief description of
what our program is.
#include <iostream>
Lines beginning with a hash sign (#) are directive for the preprocessors. They are not regular codes line
with expressions but indication for the compiler's preprocessor. In this case the directive #include
<iostream> tells the preprocessor to include the iostream standard file. This specific file (iostream)
include the declarations of the basic standard input-output library in C++, and it is included because its
functionalities are going to be used later in the program.
using namespace std;
All the elements of the standard C++ library are declared within what is called a namespaces, the
namespace with the name std. So in order to access its functionality we declares with this expression that we will be using these entitie. This line is very frequent in C++ programs that use the standard library,
and in facts it will be included in most of the source code included in this tutorial.





About the author

160