Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- struct SOTRUD{
- string surname;
- string name;
- string post;
- int yearOfBirth;
- int yearOfEmployment;
- };
- int main() {
- SOTRUD arr[8];
- for (int i=0; i<8; i++){
- cout << "Enter information about"<<i<< "employee: \n";
- cout << "Surname-";
- cin >> arr[i].surname;
- cout << "Name-";
- cin >> arr[i].name;
- cout << "Post-";
- cin >> arr[i].post;
- cout << "Year of birth-";
- cin >> arr[i].yearOfBirth;
- cout << "Year of employment-";
- cin >> arr[i].yearOfEmployment;
- }
- int minExp, minAge=0;
- cout << "Enter minimal experience: ";
- cin >> minExp;
- bool fl = 0;
- for (int i = 0; i < 8; i++){
- if (arr[i].yearOfBirth > arr[minAge].yearOfBirth)
- minAge = i;
- if (2020-arr[i].yearOfEmployment>minExp){
- fl = 1;
- cout << i << '\n' << arr[i].surname << '\n' << arr[i].name << '\n' << arr[i].post << '\n' << arr[i].yearOfBirth << '\n' << arr[i].yearOfEmployment<<'\n';
- }
- }
- if (!fl)
- cout << "Employees with required experience not found\n";
- cout << "The youngest employee: \n";
- cout << arr[minAge].surname << '\n' << arr[minAge].name << '\n' << arr[minAge].post << '\n' << arr[minAge].yearOfBirth << '\n' << arr[minAge].yearOfEmployment<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement