Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct worker
- {
- char surname[50];
- int birthdate;
- int workdate;
- } *spisok;
- int main()
- {
- int n;
- cout << "Enter amount of workers: ";
- cin >> n;
- spisok = new worker[n];
- for (int i = 0; i < n; i++)
- {
- cout << "Enter the surname of worker: ";
- cin >> spisok[i].surname;
- cout << "Enter the birthdate of worker: ";
- cin >> spisok[i].birthdate;
- cout << "Enter the date of first work: ";
- cin >> spisok[i].workdate;
- cout << endl;
- }
- worker temp;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if (spisok[i].workdate < spisok[j].workdate)
- {
- temp = spisok[i];
- spisok[i] = spisok[j];
- spisok[j] = temp;
- }
- }
- }
- for (int i = 0; i < n; i++)
- {
- if (spisok[i].birthdate > 1985)
- {
- cout << spisok[i].surname << endl << "His birthdate: " << spisok[i].birthdate << endl << "His first workdate: " << spisok[i].workdate << endl;
- }
- }
- delete[] spisok;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement