Advertisement
Sinux1

Lab9.cpp

Apr 14th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int length;
  8.  
  9.     cout <<"How many names/ids do you have? \n";
  10.     cin >> length;
  11.  
  12.     string name_list[length];
  13.     int id_list[length];
  14.  
  15.     for (int subscript = 0; subscript < length; subscript++)
  16.     {
  17.         cout << "Enter name " << subscript << endl;
  18.         cin >> name_list[subscript];
  19.         cout << "Enter " << name_list[subscript] << "'s ID\n";
  20.         cin >> id_list[subscript];
  21.     }
  22.  
  23.     cout << "Done gathering input.  You entered: \n";
  24.  
  25.     for(int subscript = 0; subscript < length; subscript++)
  26.     {
  27.         cout << id_list[subscript] << " -> " << name_list[subscript] << endl;
  28.     }
  29.  
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement