+ 7

Why we use << for cout and>> for cin..??

28th Aug 2018, 2:42 PM
M.MANIVANNAN
M.MANIVANNAN - avatar
12 Respuestas
+ 10
M.MANIVANNAN for c++, output and input is done using stream with help of global object cin and cout ... << and >> are operators.. for cout object; << operator is overloaded to display output..for cout, >> operator is not overloaded. so, when you use cout >>, you get error.. same goes with cin and >>. this is what c++ io has been implemented... in case of your own custom class, you can overload << or >> operator for any purpose you want...
28th Aug 2018, 5:30 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 4
its the insertion and excrtion operter use to input and output the value on the consloe
29th Aug 2018, 5:24 AM
Malik Honey
Malik Honey - avatar
+ 3
In cout gives the output and in cin we have to input
29th Aug 2018, 7:00 AM
SHADAB LAPPE
SHADAB LAPPE - avatar
+ 3
there is no particular reason for this bt they are operator... <<insertion operator bcz it is headed toward front it is used to print and >>extraction it is head back to take input just the logic.. well you can make ur own
29th Aug 2018, 7:41 AM
Aarav Raj
Aarav Raj - avatar
+ 2
When ever you want to use output and input, you use << and >> respectively. it doesn't have to be cout <<, it can be something like this <<
29th Aug 2018, 1:04 AM
Will
Will - avatar
+ 2
They are stream input/output (extraction/insertion) operators. Agree with Sergey Ushakov that the symbols << and >> show direction of input/output. For standard out/in I believe the format is "cout << str", "cin >> str".
29th Aug 2018, 2:00 AM
Sonic
Sonic - avatar
+ 2
Monic You right. Of course it was cout.
29th Aug 2018, 3:59 AM
Sergey Ushakov
Sergey Ushakov - avatar
+ 2
Cout is Console out.
31st Aug 2018, 6:28 AM
Alan Carreño Fiestas
Alan Carreño Fiestas - avatar
0
The operators shows direction of stream. When you print "cout << str" it looks like you move str into cout.
29th Aug 2018, 12:33 AM
Sergey Ushakov
Sergey Ushakov - avatar
0
plz tell me answer this question 1 2 3 1 2 1
29th Aug 2018, 11:26 AM
Ehtashamul Haque
Ehtashamul Haque - avatar
0
its the insertion and excrtion operter use to input and output the value on the consloe
2nd Sep 2018, 2:27 PM
Shivank Pandey
Shivank Pandey - avatar
0
Shadhab lappe is right
6th Sep 2018, 4:21 PM
Priyanka Sharma
Priyanka Sharma - avatar