PDA

View Full Version : difference of cin and cout statemenet,i have no computer back gronud i want to learn



sana.pari
04-24-2011, 06:44 PM
Subject: difference b/w cin ,cout ststement
sir pl tell me the difference of cin and cout statemenet,i have no computer back gronud i want to learn c++ language properly pl guide me

Support
04-24-2011, 06:45 PM
Dear Student,
Both cin and cout statements are stream input and output statements respectively. These statements are one of the most basic statement in any simple C/C++ program. cin statement is used to get some value from the keyboard during the program execution. On the other hand, we use cout statement to print something on the output screen. For example, if we declare a variable in our program and we want to get its value from the user, we will be using cin statement that will read the value entered from the keyborad. Here is the example below

int x;
cout<<"Enter Number";
cin>>x;

in the above code, you can see that we have used one cin statement and one cout statement. cout statement in above code will print the line "Enter Number" on the screen whenever our program is executed. cin statement will be used to take some value from the keyboard and store it in variable x.