Cin.spacething();

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!
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
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.