Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string name_list[10];
- int num_names;
- cout << "How may friends do you have?" << endl;
- cin >> num_names;
- if(num_names > 10 || num_names < 1)
- {
- cout << "Number must be in between 1 and 10" << endl;
- return 0;
- }
- for (int subscript = 0; subscript < num_names; subscript++)
- {
- cout << "Enter name " << subscript + 1 << endl;
- cin >> name_list[subscript];
- }
- cout << endl;
- cout << "All names have been stored, and here they are: " << endl << endl;
- for (int subscript = 0; subscript < num_names; subscript++)
- {
- cout << name_list[subscript] << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment