Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. const int employees_count = 5;
  6. struct employee
  7. {
  8.     int eno;
  9.     string ename;
  10.     string job;
  11.     float salary;
  12.     float bonus;
  13. };
  14. void ReceptionEmployeesData(employee arr[]);
  15. void PrintEmployeesData(employee arr[employees_count]);
  16.  
  17. void main()
  18. {
  19.     employee employees[employees_count];
  20.     ReceptionEmployeesData(employees);
  21.     cout << "#################################" << endl;
  22.     PrintEmployeesData(employees);
  23. }
  24.  
  25. void ReceptionEmployeesData(employee arr[employees_count])
  26. {
  27.     for (int i = 0; i < employees_count; i++)
  28.     {
  29.         arr[i].eno = i + 1;
  30.         cout << "(" << i + 1 << ")" << " Enter Employee Name: ";
  31.         getline(cin, arr[i].ename);
  32.         cout << "(" << i + 1 << ")" << " Enter Employee Job: ";
  33.         getline(cin, arr[i].job);
  34.         cout << endl;
  35.  
  36.         if (arr[i].job == "Manager")
  37.             arr[i].salary = 5000;
  38.         else if (arr[i].job == "Enginner")
  39.             arr[i].salary = 3000;
  40.         else if (arr[i].job == "Clerk")
  41.             arr[i].salary = 2000;
  42.         else
  43.             arr[i].salary = 1000;
  44.     }
  45. }
  46. void PrintEmployeesData(employee arr[])
  47. {
  48.     for (int p = 0; p < employees_count; p++)
  49.     {
  50.         cout << "Employee Number: " << arr[p].eno << endl;
  51.         cout << "Employee Name: " << arr[p].ename << endl;
  52.         cout << "Employee Jop: " << arr[p].job << endl;
  53.         cout << "Employee Salary: " << arr[p].salary << endl;
  54.         cout << endl << "------------------------------" << endl;
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement