Advertisement
Sinux1

T7E2.cpp

Apr 5th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7.     string name_list[10];
  8.     int num_names;
  9.  
  10.     cout << "How may friends do you have?" << endl;
  11.     cin >> num_names;
  12.  
  13.     if(num_names > 10 || num_names < 1)
  14.     {
  15.         cout << "Number must be in between 1 and 10" << endl;
  16.         return 0;
  17.     }
  18.  
  19.     for (int subscript = 0; subscript < num_names; subscript++)
  20.     {
  21.             cout << "Enter name " << subscript + 1 << endl;
  22.             cin >> name_list[subscript];
  23.     }
  24.     cout << endl;
  25.     cout << "All names have been stored, and here they are: " << endl << endl;
  26.  
  27.     for (int subscript = 0; subscript < num_names; subscript++)
  28.     {
  29.         cout << name_list[subscript] << endl;
  30.     }
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement