天天看點

哈工大sse實驗題

#include

using namespace std;

#include

int main()

{int hours; double rate,Salary;

cout << “Enter hours worked (-1 to end):” << setiosflags(ios::fixed | ios::showpoint);

cin >> hours;

while( hours!=-1)

{

cout << “Enter hourly rate of the worker ($00.00):”;

cin>>rate;

if(hours<=40)

{

Salary=hoursrate;

}

else

{

Salary=rate40+rate1.5(hours-40);

}

cout << “Salary is $” << setprecision(2) << Salary << “\n\nEnter hours worked (-1 to end):”;

cin >> hours;

}

return 0;
           

}