Advertisement
palenda21

Lab8A

Dec 7th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct worker
  6. {
  7.     char surname[50];
  8.     int birthdate;
  9.     int workdate;
  10. } *spisok;
  11.  
  12. int main()
  13. {
  14.     int n;
  15.     cout << "Enter amount of workers: ";
  16.     cin >> n;
  17.     spisok = new worker[n];
  18.     for (int i = 0; i < n; i++)
  19.     {
  20.         cout << "Enter the surname of worker:  ";
  21.         cin >> spisok[i].surname;
  22.         cout << "Enter the birthdate of worker: ";
  23.         cin >> spisok[i].birthdate;
  24.         cout << "Enter the date of first work: ";
  25.         cin >> spisok[i].workdate;
  26.         cout << endl;
  27.     }
  28.    
  29.     for (int i = 0; i < n; i++)
  30.     {
  31.     if (spisok[i].birthdate < 1980)
  32.     {
  33.         cout << "Worker that is not earlier than 1980: " << spisok[i].surname << endl;
  34.         cout << "His birth date: " << spisok[i].birthdate << endl;
  35.         cout << "His date of first work: " << spisok[i].workdate;
  36.         cout << endl;
  37.     }
  38.        else cout << "> 1980";
  39.     }
  40.    
  41.     delete[] spisok;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement