Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <sstream> // std::stringstream
- using namespace std;
- int main() {
- string inputString = "The code is getting better code.";
- string input;
- // getline(cin, input);
- stringstream stream(inputString);
- string word;
- stream >> word; // word now holds 'The'
- cout << word << endl;
- for(int i =0 ; i<5; i++)
- {
- stream >> word; // word now holds 'code'
- cout << word << endl;
- }
- }
Add Comment
Please, Sign In to add comment