why does cin.get() not ask for my input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why does cin.get() not ask for my input?

7th Jan 2017, 10:25 PM
YaySushi
3 Answers
+ 4
Because it doesn't work like that... As for cout, you need the double 'lower-than' sign operator to Console OUTput, for cin you need the double 'greater-than' sign operator to get a Console INput: cin >> my_var; [ EDIT ] Correction: triple to double, and >>> to >>
8th Jan 2017, 4:02 AM
visph
visph - avatar
+ 2
use cin.getline() instead of cin.get()
8th Jan 2017, 7:46 AM
navdeep dhakar
navdeep dhakar - avatar
0
Thanks for the answers, i was reading a book and it used cin.get() for getting input, i may have been wrong or something. thanks :)
8th Jan 2017, 3:26 PM
YaySushi