I can only have results with cout, but cin only works for the first line, and does not work for the upcoming lines, I am unable to execute my programms due to this problem. Anyhow if i delete the "cin" lines, then my programme is executed and shows all cout. But "cin" lines are not producing the results. I have checked this problem through different styles, but i am unable to have any solution. Kinly guide sir.
Posts: 95
Threads: 19
Joined: Oct 2010
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.