Statement

A statement is an instruction that tells the computer to do something.

 

Always terminated with a semi-colon ;    (*except preprocessor directives #define, #include)

 

e.g.

cout << "Hello, World!" << endl ;  //instruction to print the string, nothing has been evaluated

int a ;  //instruction to allocate storage for (declare) an integer, nothing has been evaluated

 

The above examples show statements to instruct the computer to do something.

 

If a statement needs to go over to the next line, a backslash should be used:

The backslash indicates another line is being used, and we can still see that the overall statement is terminated by the semi-colon ;

 

Compile & Run:

Hello, World!

Leave a Reply