Sunday, October 4, 2009

Whitespaces..

While programming in c++ the standard i/o object cin ignores the whitespaces.

You can use std::noskipws to disable the whitespace skipping that std::cin does by default:

#include 
#include

int main() {
char c;
std
::cin >> std::noskipws;
while (std::cin >> c) {
if (c == ' ')
std
::cout << "A space!" << std::endl;
}
return 0;
}