Last active
December 11, 2015 17:08
-
-
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 )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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