Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- const int employees_count = 5;
- struct employee
- {
- int eno;
- string ename;
- string job;
- float salary;
- float bonus;
- };
- void ReceptionEmployeesData(employee arr[]);
- void PrintEmployeesData(employee arr[employees_count]);
- void main()
- {
- employee employees[employees_count];
- ReceptionEmployeesData(employees);
- cout << "#################################" << endl;
- PrintEmployeesData(employees);
- }
- void ReceptionEmployeesData(employee arr[employees_count])
- {
- for (int i = 0; i < employees_count; i++)
- {
- arr[i].eno = i + 1;
- cout << "(" << i + 1 << ")" << " Enter Employee Name: ";
- getline(cin, arr[i].ename);
- cout << "(" << i + 1 << ")" << " Enter Employee Job: ";
- getline(cin, arr[i].job);
- cout << endl;
- if (arr[i].job == "Manager")
- arr[i].salary = 5000;
- else if (arr[i].job == "Enginner")
- arr[i].salary = 3000;
- else if (arr[i].job == "Clerk")
- arr[i].salary = 2000;
- else
- arr[i].salary = 1000;
- }
- }
- void PrintEmployeesData(employee arr[])
- {
- for (int p = 0; p < employees_count; p++)
- {
- cout << "Employee Number: " << arr[p].eno << endl;
- cout << "Employee Name: " << arr[p].ename << endl;
- cout << "Employee Jop: " << arr[p].job << endl;
- cout << "Employee Salary: " << arr[p].salary << endl;
- cout << endl << "------------------------------" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement