Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     vector<string> my_strings;
  10.  
  11.     for (int i=0; i < 5; i++){
  12.         cout << i << ": ";
  13.        
  14.         string s;
  15.         getline(cin, s);
  16.         my_strings.push_back(s);
  17.        
  18.         if (s.empty()){
  19.             break;
  20.         }
  21.     }
  22.  
  23.     for (int i=0; i < my_strings.size(); i++){
  24.         cout << my_strings[i] << "\n";    
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement