c++ user input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

c++ user input

I don't understand the working method of cin >> num. Please elaborate this.

12th Sep 2017, 3:06 PM
Raktim Modak
Raktim Modak - avatar
2 Answers
+ 9
>> is an overloaded operator used for a method in the istream class. cin is an object of type istream. So, cin >> (args); is calling the method that takes the users input.
12th Sep 2017, 3:13 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
cin is an object with type std::istream. This class contains a method std::istream::operator>> which takes an argument, and stores the input in said argument. What this function exactly does depends on the OS, but for unix systems, it is almost the same as the "read" function, just with some things added, like splitting inputs if a space is written in the prompt.
12th Sep 2017, 3:14 PM
Testing003