Skip to content

Instantly share code, notes, and snippets.

@tangentstorm
Last active December 11, 2015 17:08
Show Gist options
  • Save tangentstorm/4632468 to your computer and use it in GitHub Desktop.
Save tangentstorm/4632468 to your computer and use it in GitHub Desktop.
c++ experiment : does cin split on any whitespace, or on newline? ( answer : whitespace )
#include <iostream>
#include <string>
int main() {
std::string word;
int i;
std::cout << "enter 3 words: ";
for ( i = 0; i < 3; ++i ) {
std::cin >> word;
std::cout << word << "\n";
}
}
enter 3 words: one two three
one
two
three
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment