cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Cin.spacething();
Cin.spacething();
Jun 13, 2013 at 10:04pm UTC
Perry Turner
(46)
Hi, I'm just wondering if there is something I could use that is like
cin.get();
but for the space bar instead of the enter key. Thanks!
Jun 13, 2013 at 10:12pm UTC
Peter87
(11234)
cin.get();
reads the next character. It doesn't care what character it is.
If you want to get rid of all whitespace characters (space, tab, newline, etc.) up until the next non-whitespace character you can do
std::cin >> std::ws;
.
Last edited on
Jun 13, 2013 at 10:13pm UTC
Jul 2, 2013 at 10:18am UTC
Perry Turner
(46)
Thank You! I did not know that! I have been doing c++ for a year now and never noticed that. I feel pretty dumb...
Topic archived. No new replies allowed.