Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string *thing_list;
- int size;
- cout << "How many phones do you have?" << endl;
- cin >> size;
- cin.ignore();
- // If you do not declare new, on other compilers, it will compile error
- thing_list = new string[size];
- for(int subscript = 0; subscript < size; subscript++)
- {
- cout << "Enter phone name " << endl;
- getline(cin, thing_list[subscript]);
- }
- cout << "Thanks for all of those phone names!!!" << endl;
- for (int sub = 0; sub < size; sub++)
- {
- cout << thing_list[sub] << endl;
- }
- delete[] thing_list;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement