Thursday, April 7, 2016

The cin Statement

 The cin Statement  


Just as we have the ‘cout’ statement to display data on the screen, the ‘cin’ statement is used to extract data from the user or insert data into a variable. The statement is used with the insertion operators (<<). It is also defined under the <iostream.h> header file and has the following syntax:
           
Syntax: cin>>variable1>>variable2…………….;  

You may observe that we have used the insertion operator repeatedly ‘>>’ in the syntax. This is perfectly valid and is known as cascading of operators.

No comments:

Post a Comment