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(input);
- string word;
- stream >> word; // word now holds 'I'
- int number = atoi(word.c_str());
- for(int i =0 ; i<number; i++)
- {
- stream >> word; // word now holds 'am'
- cout << word << endl;
- }
- }
Add Comment
Please, Sign In to add comment