The first line is  # include <iostream.h>

This is preprocessor directive. The features of preprocessor will be discussed later. For the time being take this line on faith. You have to write this line. The sign # is known as HASH and also called SHARP.

The next line contains main().

There is a main() in every C program. It occurs once in a program. When we write a program and it compiles successfully, it converts into an executable program (file). Then we execute it by typing the command or by double clicking in graphical interface. The system then loads the program into memory. Now the question arises from where the execution should start. In C programs the execution always starts from the main(). In large programs there may be many modules. But the starting point of the program will always be the main function.

Notice that there are parentheses (“( )”, normal brackets) with main. Here the parentheses contain nothing. There may be something written inside the parentheses. It will be discussed in next lectures.

Next, there is a curly bracket also called braces("{ }"). Here is a thing to remember that brackets (parentheses ( ) and braces { }) always occur in pairs. The body of main is enclosed in braces. Braces are very important in C; they enclose the blocks of the program.

The next line in the program,

                cout << “ Welcome to Virtual University of Pakistan”;

is a statement in C language. There are many things in this line to be discussed. Let’s see them one by one.

The word ‘cout’ is known as stream in C and C++. Stream is a complicated thing, you will learn about it later. Think a stream as a door. The data is transferred through stream, cout takes data from computer and sends it to the output that is the screen of the monitor. So we use cout for output.

 

 

 

Previous

 

 

TOC

 

 

Next