Advertisement
sheredega

Task #7

Dec 10th, 2022 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     string arr[100][2];
  8.     cout << "Enter the number of records: ";
  9.     cin >> n;
  10.     for (int i = 0; i < n; i++) {
  11.         cout << "Enter name of " << i + 1 << " person: ";
  12.         cin >> arr[i][0];
  13.         cout << "Enter surname of " << i + 1 << " person: ";
  14.         cin >> arr[i][1];
  15.     }
  16.  
  17.     cout << "# | Name | Surname\n";
  18.     for (int i = 0; i < n; i++) {
  19.         cout << i + 1;
  20.         for (int j = 0; j < 2; j++) {
  21.             cout << " | " << arr[i][j];
  22.         }
  23.         cout << endl;
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement