Created
January 31, 2018 18:02
-
-
Save sonOfRa/8585db89bb556bdf0cf414d1945c0478 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| #include <sstream> | |
| #include <vector> | |
| #include <iterator> | |
| int main() | |
| { | |
| std::string line = "This string has several words"; | |
| std::istringstream iss(line); | |
| std::vector<std::string> words((std::istream_iterator<std::string>(iss)), | |
| std::istream_iterator<std::string>()); | |
| std::cout << words.size() << std::endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment