Untitled
unknown
c_cpp
2 years ago
1.7 kB
18
Indexable
Never
#include <iostream> using namespace std; struct staff { string surname; string name; string patronymic; long int number; string month; }; int main() { staff personnel[]{ {"Kobzar", "Nika", "Viktorovna", 668815296, "January"}, {"Bondarenko", "Anna", "Lvovna", 931635977, "February"}, {"Lanovoi", "Vsevolod", "Fedorovich", 966689101, "April"}, {"Korsakov", "Ivan", "Olegovic", 932417082, "May"}, {"Sokolova", "Maria", "Nikolaevna", 632874238, "June"}, {"Molchanov", "Pavel", "Vladimirovich", 989812787, "July"}, {"Sokolova", "Sofia", "Sergeevna", 683487101, "August"}, {"Kotov", "Sergei", "Viktorovich", 985638372, "September"}, {"Popova", "Ekaterina", "Ivanovna", 990123915, "October"}, {"Romanova", "Tatiana", "Vladimirovna", 631875795, "November"}, {"Ivanov", "Andrey", "Sergeevich", 911192900, "December"}, {"Lebedeva", "Nastya", "Alexeyevna", 993811235, "May"} }; string month; cout << "Enter the month: "; cin >> month; cout << endl; for (int i = 0; i < sizeof(personnel) / sizeof(*personnel); i++) { if (personnel[i].month == month) { cout << "Surname: " << personnel[i].surname << endl; cout << "Name: " << personnel[i].name << endl; cout << "Patronymic: " << personnel[i].patronymic << endl; cout << "Number: " << personnel[i].number << endl; cout << "Month: " << personnel[i].month << endl; cout << endl; } else{ cout<< "Employee not found" << endl; break; } } return 0; }