// This program uses an array of structures to hold payroll data. #include #include using namespace std; struct PayInfo { int hours; // Hours worked double payRate; // Hourly pay rate PayInfo(int h=0, double p=0.0) //Constructor { hours = h; payRate = p; } }; int main() { const int NUM_EMPS = 3; // Number of employees int index; PayInfo workers[NUM_EMPS] = { // Define and initialize array of structures PayInfo(10, 9.75), PayInfo(20, 10.00), PayInfo(30, 20.00) }; double grossPay; // Display each employee's gross pay cout << "\nHere is the gross pay for each employee:\n"; cout << fixed << showpoint << setprecision(2); for (index = 0; index < NUM_EMPS; index++) { grossPay = workers[index].hours * workers[index].payRate; cout << "Employee #" << (index + 1); cout << ": $" << setw(7) << grossPay << endl; } return 0; }