W t error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

W t error?

#include <iostream> #include <string> using namespace std; struct employee { int eno; string ename; string job; float salary; float bonus ; float total_salary; }; void get_data (employee arr[] , int size ); void set_bonus (employee e , float percent); void print (employee arr [] , int size); int main() { employee emps [5]; get_data (emps , 5); set_bonus (emps [1], 0.1f); print (emps , 5); } void get_data (employee arr[] , int size ) { for (int i=0; i<size; i++) { cout << "Enter employee no, name, job \n"; cin >> arr[i].eno>>arr[i].ename >>arr[i].job; if (arr[i].job == "Manager") arr[i].salary = 5000; else if (arr[i].job == "Engineer") arr[i].salary = 3000; else if (arr[i].job == "Clerk") arr[i].salary = 2000; else arr[i].salary = 1000; } } void set_bonus (employee &e , float percent) { e.bonus = e.salary * percent; } void print (employee arr[] , int size) { for (int i=0; i<size; i++) cout << "Emp No."<< arr[i].eno <<

28th Jan 2021, 6:58 AM
eyad omar
eyad omar - avatar
1 Answer
+ 3
eyad omar The code is truncated because it exceeds Description character limits. You need to save that code in SoloLearn and share the link instead. Follow below guide to share the code link https://www.sololearn.com/post/75089/?ref=app
28th Jan 2021, 8:36 AM
Ipang