This is my code for the problem
write a program that manipulates employee record .define an employee
record containing the information. in the main program declare an
array of ten employees and write loop that calls afunaction
(getEmployee) to read information about asingle employee the function
should return an employee struct that can be assigned to the next
available slot of array .after each new employee is entered ask the
user if they want to enter information for another employee .when the
array is filled or the user doesn't want any more employees .write a
oop that displays
all the employees by repeatedly calling the display employee function
to display each individual employee
# include<iostream>
#include<string>
using namespace std;
struct employee {
string last_name;
string first_name;
double hourly_rate;
double hours_worked;
};
employee getEmployee(void);
void displayEmployee(const employee&);
void main()
{
employee ee[10];
for(int i=0;i<=10;i++) {
cout<<"enter the employee information";
ee[i]= getEmployee();
bool enter;
enter =true;
cout<<"do you wish to enter another employee information";
cout<<"enter either 1 or 0";
cin>>enter;
if(enter ==1)
ee[i+1] = getEmployee();
else if (enter==0)
cout<<"thanks for using";
displayEmployee(ee[i]);
}
for( int j =0;j<=10;j++)
{
displayEmployee(ee[j]);
}
}
employee getEmployee() {
employee e;
cout<<"enter employee's lastname";
cin>>e.last_name;
cout<<"enter first name";
cin>>e.first_name;
cout<<"enter hourly rate";
cin>>e.hourly_rate;
cout<<"enter hours worked";
cin>>e.hours_worked;
return e;
}
void displayEmployee(const employee &worker) {
cout<<"Employee Last name"<<worker.first_name;
cout<<"Employee First name"<<worker.last_name;
cout<<"Employee hourly rate"<<worker.hourly_rate;
cout<<"Employee hours worked"<<worker.hours_worked;
}