Still can't get it to add total.
I need this code to produce the sum of all four weeks wages that I am trying to compute. Am I missing a function to do this? It will produce the last weeks wages correctly, but not the rest and won't add it to the total. //*************************************************** //Determine gross pay for a four-week period based //on hourly rate and number of hours worked each week // with any hours over 40 being paid time-and-a-half //*************************************************** #include <iostream> void calcPay (double, double, double&); //Declaring a function before using & pointer to return const float MAX_HOURS = 40.0; const float OVERTIME = 1.5; using namespace std; int main() { double payRate = 0.0; double wages = 0.0; cout << "Enter pay rate amount:
quot;; cin >> payRate; for(int i=0; i<hours[]; i++) { cout<<"Enter "<<(i+1)<<" week working hours: "; cin >> hours[]; } calcPay(payRate, hours[], wages); cout <<"Wages earned this month are " << wages << "."; return 0; } void calcPay (double payRate, double hours[], double& wages) { if (hours[] > MAX_HOURS) { wages = MAX_HOURS * payRate + (hours[] - MAX_HOURS) * OVERTIME * payRate; } else { wages = hours[] * payRate; } return; } The output is this: Enter pay rate amount: $10 Enter 1 week working hours: 40 Enter 2 week working hours: 40 Enter 3 week working hours: 40 Enter 4 week working hours: 50 Wages earned this month are 550. Process returned 0 (0x0) execution time : 4.446 s Press any key to continue.