Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct SOTRUD{
  6. string surname;
  7. string name;
  8. string post;
  9. int yearOfBirth;
  10. int yearOfEmployment;
  11. };
  12.  
  13. int main() {
  14. SOTRUD arr[8];
  15. for (int i=0; i<8; i++){
  16. cout << "Enter information about"<<i<< "employee: \n";
  17. cout << "Surname-";
  18. cin >> arr[i].surname;
  19. cout << "Name-";
  20. cin >> arr[i].name;
  21. cout << "Post-";
  22. cin >> arr[i].post;
  23. cout << "Year of birth-";
  24. cin >> arr[i].yearOfBirth;
  25. cout << "Year of employment-";
  26. cin >> arr[i].yearOfEmployment;
  27. }
  28. int minExp, minAge=0;
  29. cout << "Enter minimal experience: ";
  30. cin >> minExp;
  31. bool fl = 0;
  32. for (int i = 0; i < 8; i++){
  33. if (arr[i].yearOfBirth > arr[minAge].yearOfBirth)
  34. minAge = i;
  35.  
  36. if (2020-arr[i].yearOfEmployment>minExp){
  37. fl = 1;
  38. cout << i << '\n' << arr[i].surname << '\n' << arr[i].name << '\n' << arr[i].post << '\n' << arr[i].yearOfBirth << '\n' << arr[i].yearOfEmployment<<'\n';
  39. }
  40. }
  41. if (!fl)
  42. cout << "Employees with required experience not found\n";
  43. cout << "The youngest employee: \n";
  44. cout << arr[minAge].surname << '\n' << arr[minAge].name << '\n' << arr[minAge].post << '\n' << arr[minAge].yearOfBirth << '\n' << arr[minAge].yearOfEmployment<<'\n';
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement