difference between cin.get(ch) and getch()?

Sep 7, 2012 at 1:25am
1) difference between getch() and cin.get(ch).
2)char ch;
why does cin.get(ch) read space,new line or tab but,cin>>ch does not?
Sep 7, 2012 at 8:56am
Because there is a default manipulator/flag set on cin to discard those specific characters but when u call cin.get(ch) the get() is defined to capture any character input into the stream. For cin >> ch; to have the same behavior simply place this line before it
cin >> noskipws;
Last edited on Sep 7, 2012 at 8:57am
Topic archived. No new replies allowed.