Advertisement
Sinux1

T8E4.cpp

Apr 19th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.     string *thing_list;
  9.     int size;
  10.  
  11.     cout << "How many phones do you have?" << endl;
  12.     cin >> size;
  13.     cin.ignore();
  14.  
  15.     // If you do not declare new, on other compilers, it will compile error
  16.     thing_list = new string[size];
  17.     for(int subscript = 0; subscript < size; subscript++)
  18.     {
  19.         cout << "Enter phone name " << endl;
  20.         getline(cin, thing_list[subscript]);
  21.     }
  22.  
  23.     cout << "Thanks for all of those phone names!!!" << endl;
  24.     for (int sub = 0; sub < size; sub++)
  25.     {
  26.         cout << thing_list[sub] << endl;
  27.     }
  28.  
  29.     delete[] thing_list;
  30.  
  31.  
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement