cin Object

Default Image

cin is the
standard input object as like cout is the standard output object. It is
used to get input from user. It helps to get any type of input in the
programme, that may be an integer value, character or string. Input
could be from a user through keyboard or from a file. It is used with
extraction operator (>>) to receive input. Syntax that we use is:

           cin>>variable_name;


Using single object and multiple extraction operators we can get multiple values for multiple variables. For example:


           cin>>variable1>>variable2>>……….>>variable;








#include

#include

void main()

{

clrscr();

int a;

cout<<“Enter the number for variable: “; cin>>a;

cout<<“Your entered number is: “<
getch();

}

Output of the above programme will be:


How-cin-works



Read Count: 3 times

Comments

No comments yet.

Leave a Comment