Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <windows.h>
  4. using namespace std;
  5. struct time
  6. {
  7. int day;
  8. int month;
  9. int year;
  10. } current;
  11. struct date
  12. {
  13. int day;
  14. int month;
  15. int year;
  16. };
  17. struct info
  18. {
  19. string surname; // фамилия
  20. string name; // имя
  21. string patronymic; // по батькови
  22. string gender; // пол
  23.  
  24. date date;
  25. };
  26. int main()
  27. {
  28. SetConsoleCP(1251);
  29. SetConsoleOutputCP(1251);
  30. cout << "Введите текущую дату заполнения: " << endl;
  31. cout << "День (1-31): ";
  32. cin >> current.day;
  33. cout << "Месяц (1-12): ";
  34. cin >> current.month;
  35. cout << "Год: ";
  36. cin >> current.year;
  37. int n;
  38. cout << endl << "Введите кол-во анкет сотрудников для заполнения: ";
  39. cin >> n;
  40. info *jobs;
  41. jobs = new info [n];
  42.  
  43. int *array = new int [n];
  44.  
  45. for (int i=0; i < n; i++)
  46. {
  47. cout << endl << "<= Заполните пожалуйста " << i+1 << " анкету =>" << endl;
  48. cout << "Фамилия: ";
  49. cin.get();
  50. getline (cin, jobs[i].surname);
  51. cout << "Имя: ";
  52. getline (cin, jobs[i].name);
  53. cout << "Отчество: ";
  54. getline (cin, jobs[i].patronymic);
  55. cout << "Пол (Мужчина / Женщина): ";
  56. getline (cin, jobs[i].gender);
  57. cout << "День рождения (1-31): ";
  58. cin >> jobs[i].date.day;
  59. cout << "Месяц рождения (1-31): ";
  60. cin >> jobs[i].date.month;
  61. cout << "Год рождения: ";
  62. cin >> jobs[i].date.year;
  63. cout << endl;
  64. }
  65.  
  66. for (int i=0; i < n; i++)
  67. {
  68. if ((jobs[i].date.month - current.month == 0 && current.day - jobs[i].date.day >= 0) || (jobs[i].date.month - current.month < 0))
  69. array[i] = jobs[i].date.year -1;
  70. }
  71.  
  72. cout << " *** ДАННЫЕ О СОТРУДНИКАХ ПЕНСИОННОГО ВОЗРАСТА *** " << endl << endl;
  73.  
  74. for (int i=0; i < n; i++)
  75. {
  76. if ((array[i] < current.year - 62 && jobs[i].gender == "Мужчина") || (array[i] < current.year - 60 && jobs[i].gender == "Женщина"))
  77. {
  78. cout << "Фамилия: " << jobs[i].surname << endl;
  79. cout << "Имя: " << jobs[i].name << endl;
  80. cout << "Отчество: " << jobs[i].patronymic << endl;
  81. cout << "Пол: " << jobs[i].gender << endl;
  82. cout << "Дата рождения: " << jobs[i].date.day << '/' << jobs[i].date.month << '/'<< jobs[i].date.year << endl << endl;
  83. }
  84. else
  85. cout << "Не найдено!";
  86. }
  87.  
  88. delete [] jobs;
  89. delete [] array;
  90. system("pause");
  91. return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement