请教各位大侠,帮我看看这个程序
#include<iostream>#include<string>
using namespace std;
class Payroll{
public:
Payroll(){};
Payroll(double time,double salary)
{
workTime=time;
salaryPurHour=salary;
}
void setWorkTime()
{ cout<<"输入一周工作时间:";
cin>>workTime;
}
double getWorkTime()
{
return workTime;
}
double getSalaryPurHour (double salary)
{
salaryPurHour=salary;
return salaryPurHour;
}
double getTotalSalary()
{
double totalSalary=workTime*salaryPurHour;
return totalSalary;
}
private:
double workTime;
double salaryPurHour;
double totalSalary;
};
int main(){
Payroll myPayrollArray[10];
int i;
for(i=0;i<10;i++)
myPayrollArray[i] .setWorkTime();
cout<<"雇员\t\t"<<"本周工作时间\t\t"<<"单位时间工资\t\t"<<"本周应付总工资\t\t";
for( i=0;i<10;i++)
{
cout<<i+1<<"\t\t"<<myPayrollArray[i].getWorkTime ()<<"\t\t"<<myPayrollArray[i].getSalaryPurHour(50)
<<"\t\t"<<myPayrollArray[i].getTotalSalary()<<endl;
}
return 0;
}
为什么这个程序输出不对