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 bands do you listen to?" << 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 band " << subscript << endl;
- getline(cin, thing_list[subscript]);
- }
- cout << "Got it. Here is the reverse of that list.\n";
- for (int sub = size - 1; sub >= 0; sub--)
- {
- cout << thing_list[sub] << endl;
- }
- delete[] thing_list;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement