#include<iostream>
using namespace std;
struct Employee{
char name [25];
float rate, daysWork, lessDeduction, cashAdvance, absences;
float netSalary;
};
main(){
int i;
float gross= 0;
float totalDeduction=0;
float netSalary=0;
Employee Emp[10];
for(i=0;i<10;i++);{
cout << "\nEmployee : ";
cin >> Emp[i].name;
cout << "\nRate Per Day: ";
cin >> Emp[i].rate;
cout << "\nDays Worked: ";
cin >> Emp[i].daysWork;
gross= Emp[i].rate*Emp[i].daysWork;
cout << "\nGross Salary: "<<gross;
cout << "\n\nLess Deduction: ";
cin >> Emp[i].lessDeduction;
cout << "\nCash Advance: ";
cin >> Emp[i].cashAdvance;
cout << "\nAbsences: ";
cin >> Emp[i].absences;
totalDeduction= Emp[i].lessDeduction+Emp[i].cashAdvance+Emp[i].absences;
cout << "\nTotal Deduction: "<<totalDeduction;
netSalary= gross-totalDeduction;
cout << "\nNet Salary: "<<netSalary;
}
cout<<"\nFinal Output: ";
cout<<"\nList of Employees: ";
for(i=0;i<10;i++)
cout<<Emp[i].name;
cout<<"\nTotal Net Salary: "
<<Emp[i].netSalary;
}
1) The program must include two or more loops.
2) You can use any looping statement (for, while, or do-while).
3) The program must accept inputs for 10 employees.
4) It must show all employees and their total net salaries at the end of the nested loop.
Sample Input / Output :
Employee 1 : A
Rate Per Day : _______
Days Worked : ______
Gross Salary : (product)
Less Deduction :
Cash Advance : ______
Absences : ______
Total Deduction : (total deduction)
Net Salary : (difference between Gross Salary and Total Deduction)
(Repeat this for 10 employees)
Final Output :
List of Employees : A, B, C, D, E, F, G, H, I, j
Total Net Salary : (total of all net salaries)
for(i=0;i<10;i++);
it loops. It just does not do anything 10 times because of that ;
And near the end, needs braces around the last 3 lines.