In a example in my book they used cin >> ch, instead of using cin.get(ch) or ch = cin.get().
The reason is that cin >> ch, skips all whitespace including '\n'.
cin.get(ch) will read all input characters, including spaces and newlines.
So it is often more easy to use cin >> ch then using cin.get(), however ofcourse you can program arround the cin.get() behaviour.
Abonneren op:
Reacties posten (Atom)
Geen opmerkingen:
Een reactie posten