#include <iostream>
using std::cout;
using std::cin;
using std::endl;
void Calculate( double );
int main()
{
int worked;
double salary;
double pay;
cout << "Enter the hours worked: (-1 to end)" << endl;
cin >> worked;
cout << "Enter the salary: " << endl;
cin >> salary;
while( worked > 0 ){
Calculate( );
cout << "Enter the hours worked: (-1 to end)" << endl;
cin >> worked;
cout << "Enter the salary: " << endl;
cin >> salary;
}
system("pause");
return(0);
}
void Calculate( double )
{
double over;
double half;
double extra;
double pay;
int worked;
double salary;
if(worked > 40){
over = worked - 40;
half = salary * 1.5;
extra = over * half;
pay = (worked * salary) + extra;
cout << "The pay is: " << "$" << pay << endl;
}
else
pay = worked * salary;
cout << "The pay is: " << "$" << pay << endl;
}
Ok, finally fixed the code tags. =P