Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- struct employee
- {
- int no;
- string name;
- string job;
- float salary;
- float bonus;
- };
- void get_data (employee arrays[],int size);
- void set_bonus (employee bonus_s, float percent);
- int main ()
- {
- employee empo[5];
- get_data(empo,5);
- }
- void get_data (employee arrays[],int size)
- {
- for (int i = 0; i < 5; i++)
- {
- arrays[i].no = i + 1;
- cout<<"nEnter the data of employee no."<<i + 1<<" :n";
- cout<<"ttTip! : name, job, bonusn";
- cin>>arrays[i].name>>arrays[i].job>>arrays[i].bonus;
- if (arrays[i].job == "Engineer")
- arrays[i].salary = 3000;
- else if (arrays[i].job == "Manager")
- arrays[i].salary = 5000;
- else if (arrays[i].job == "Clerck")
- arrays[i].salary = 2000;
- else
- arrays[i].salary = 1000;
- }
- }
- void set_bonus (employee bonus_s ,float percent)
- {
- bonus_s.bonus = bonus_s.salary * percent;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement