Using cin to get user input.

Pages: 12
I'm not sure if you could do this, but could you possibly overload the >> operator for cin and make it call getline()?
Well I`d only like to ask whether there is any difference in speed. I mean, if I was doing a problem where there are no chances of getting the wrong values, which would be faster?
In reality I'd hardly even consider the speed difference between the 2 approaches. If your worried about speed, then the speed of a cin/cout should be the last place your looking.
Update: Added information about cin not removing newline characters and mixing cin >> var; with getline();
Topic archived. No new replies allowed.
Pages: 12