Share your repls and programming experiences

← Back to all posts
each employee's grosspay
XIAOXIAQIAN (0)

#include <iostream>
#include<iomanip>
using namespace std;
int main() {
const int Num_employees=5;
int hour[Num_employees];
double payRate;
double grossPay;

for(int Num_employees=0;Num_employees<5;Num_employees++)
{
cout<<"Enter the hours worked by employee "<<Num_employees+1<<"# \n";
cin>>hour[Num_employees];
}

cout<<"Enter hourly pay rate for all the employees:$ ";
cin>>payRate;

cout<<"Here is gross pay by each employee: \n";
cout<<fixed<<showpoint<<setprecision(2);
for(int index=0;index<Num_employees;index++)
{
grossPay=hour[index]*payRate;
cout<<"Employee# "<<index+1;
cout<<":$ "<<grossPay<<endl;
}

return 0;

}