04-24-2011, 05:17 PM
Dear student!
cout is output stream & cin is input stream.
cout statement is for displaying output of program on screen. whatever you write in double quotes, it is printed on screen.
cout<<"Hello world";
Hello world will be printed on screen.
If you write
cout<<a; Then value of a would be printed on screen
Cin is not for displaying output, it takes input stream. Whatever you give input, it is stored in cin stream
Example:
cout<< enter your age";
cin>>age;
First line is asking for entering your input where input would be stored in age. I hope your ambiguity would have cleared now.
cout is output stream & cin is input stream.
cout statement is for displaying output of program on screen. whatever you write in double quotes, it is printed on screen.
cout<<"Hello world";
Hello world will be printed on screen.
If you write
cout<<a; Then value of a would be printed on screen
Cin is not for displaying output, it takes input stream. Whatever you give input, it is stored in cin stream
Example:
cout<< enter your age";
cin>>age;
First line is asking for entering your input where input would be stored in age. I hope your ambiguity would have cleared now.
