The sign << indicates the direction of data. Here it is towards cout and the function of cout is to show data on the screen.

The thing between the double quoutes (“ ”) is known as character string. In C programming character strings are written in double quotes. Whatever will be written in quotation marks the sign << will direct it towards cout which will show it on the screen.

There is a semicolon (;) at the end of the statement. This is very important. All C statements end with semicolon (;). Missing of a semicolon (;) at the end of statement is a syntax error and compiler witll report an error during compilation. The only semicolon (;) on a line is a null statement. It does nothing. The extra semicolons may be put at the end but are useless and aimless. Do not put semicolon (;) at a wrong place, it may cause a problem during the execution of the program or may cause a logical error.

In this program we give a fixed character string to cout and the program prints it to the screen as:

Welcome to Virtual University of Pakistan

 

 

 

Previous

 

 

TOC

 

 

Next