Heres the statement, will explain problem after
Code:
//Lab 02 - 4.16 Salary Calculator
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int hoursWorked = 0;
int hourlyRate = 0;
int salary = 0;
cout << "Enter hours worked (-1 to end): ";
cin >> hoursWorked;
cout << "Enter hourly rate of employee (00.00): ";
cin >> hourlyRate;
while(hoursWorked > -1)
{
if(hoursWorked <= 40)
{
salary = hoursWorked*hourlyRate;
cout << "Salary is: " << salary << endl;
}
else
{
salary = (40 * hourlyRate) + (hoursWorked - 40)*hourlyRate;
cout << "Salary is: " << salary << endl;
}
cout << "Enter hours worked (-1 to end): ";
cin >> hoursWorked;
cout << "Enter hourly rate of employee (00.00): ";
cin >> hourlyRate;
}
system("pause");
return 0;
}
The problem I'm getting is that after entering the hoursWorked and hourlySalary it constantly repeats 'Enter hours worked (-1 to end): Salary is 390.00' over and over untill I turn the program off, just getting started back after not programming for a while so its probably a stupid mistake, please help! :P