Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <windows.h>
- using namespace std;
- struct time
- {
- int day;
- int month;
- int year;
- } current;
- struct date
- {
- int day;
- int month;
- int year;
- };
- struct info
- {
- string surname; // фамилия
- string name; // имя
- string patronymic; // по батькови
- string gender; // пол
- date date;
- };
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- cout << "Введите текущую дату заполнения: " << endl;
- cout << "День (1-31): ";
- cin >> current.day;
- cout << "Месяц (1-12): ";
- cin >> current.month;
- cout << "Год: ";
- cin >> current.year;
- int n;
- cout << endl << "Введите кол-во анкет сотрудников для заполнения: ";
- cin >> n;
- info *jobs;
- jobs = new info [n];
- int *array = new int [n];
- for (int i=0; i < n; i++)
- {
- cout << endl << "<= Заполните пожалуйста " << i+1 << " анкету =>" << endl;
- cout << "Фамилия: ";
- cin.get();
- getline (cin, jobs[i].surname);
- cout << "Имя: ";
- getline (cin, jobs[i].name);
- cout << "Отчество: ";
- getline (cin, jobs[i].patronymic);
- cout << "Пол (Мужчина / Женщина): ";
- getline (cin, jobs[i].gender);
- cout << "День рождения (1-31): ";
- cin >> jobs[i].date.day;
- cout << "Месяц рождения (1-31): ";
- cin >> jobs[i].date.month;
- cout << "Год рождения: ";
- cin >> jobs[i].date.year;
- cout << endl;
- }
- for (int i=0; i < n; i++)
- {
- if ((jobs[i].date.month - current.month == 0 && current.day - jobs[i].date.day >= 0) || (jobs[i].date.month - current.month < 0))
- array[i] = jobs[i].date.year -1;
- }
- cout << " *** ДАННЫЕ О СОТРУДНИКАХ ПЕНСИОННОГО ВОЗРАСТА *** " << endl << endl;
- for (int i=0; i < n; i++)
- {
- if ((array[i] < current.year - 62 && jobs[i].gender == "Мужчина") || (array[i] < current.year - 60 && jobs[i].gender == "Женщина"))
- {
- cout << "Фамилия: " << jobs[i].surname << endl;
- cout << "Имя: " << jobs[i].name << endl;
- cout << "Отчество: " << jobs[i].patronymic << endl;
- cout << "Пол: " << jobs[i].gender << endl;
- cout << "Дата рождения: " << jobs[i].date.day << '/' << jobs[i].date.month << '/'<< jobs[i].date.year << endl << endl;
- }
- else
- cout << "Не найдено!";
- }
- delete [] jobs;
- delete [] array;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement