Hi guys,
I am trying to use array with function to print out wages of each employees. something wrong with my function of the last part of my program, giving me an error. can you tell me what i am doing wrong here. here is my code:
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
void setHours(int[],int);
void setWage(int[],int);
int getTotal(int[],int);
int main()
{
const int SIZE=7;
int Hrate[SIZE];
int hours;
int index;
int total;
cout<<"enter hourly rate for employees: "<<endl;
cout<<endl;
setHours(Hrate,SIZE);
cout<<"enter hours for employees: "<<endl;
setWage(Hrate,SIZE);
cout<<"The total hours for employees are: "<<endl;
cout<<"employees hours: "<<total= getTotal(Hrate, SIZE);
return 0;
}
void setHours(int hour[],int SIZE){
for( int x=1;x<SIZE;x++)
{
cout<<"hourly rate for employee "<<x<<" is: ";
cin>>hour[x];
}
}
void setWage(int Wage[],int SIZE)
{
for( int count=1;count<SIZE;count++)
{
cout<<"enter the hours for employe "<<count<<" :";
cin>>Wage[count];
}
}
int getTotal(int y[],int SIZE)
{
for(int y=1;y<SIZE;y++)
total= Wage[y]*hours[y];
return total;
}