Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. struct employee
  5. {
  6. int no;
  7. string name;
  8. string job;
  9. float salary;
  10. float bonus;
  11. };
  12. void get_data (employee arrays[],int size);
  13. void set_bonus (employee bonus_s, float percent);
  14. int main ()
  15. {
  16. employee empo[5];
  17. get_data(empo,5);
  18. }
  19.  
  20.  
  21. void get_data (employee arrays[],int size)
  22. {
  23. for (int i = 0; i < 5; i++)
  24. {
  25. arrays[i].no = i + 1;
  26. cout<<"nEnter the data of employee no."<<i + 1<<" :n";
  27. cout<<"ttTip! : name, job, bonusn";
  28. cin>>arrays[i].name>>arrays[i].job>>arrays[i].bonus;
  29. if (arrays[i].job == "Engineer")
  30. arrays[i].salary = 3000;
  31. else if (arrays[i].job == "Manager")
  32. arrays[i].salary = 5000;
  33. else if (arrays[i].job == "Clerck")
  34. arrays[i].salary = 2000;
  35. else
  36. arrays[i].salary = 1000;
  37. }
  38. }
  39.  
  40.  
  41. void set_bonus (employee bonus_s ,float percent)
  42. {
  43.  
  44. bonus_s.bonus = bonus_s.salary * percent;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement