I have written this code and for some reason when the user inputs hours less than 40 i get different answers. I have done this type of code before and can see where i made a syntax error. Any help to see where I went wrong. For hours over 40 the code compiles fine,
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
//variable section
double hoursWorked = 0.00; //hours worked during the week.
double hourlyRate = 0.00; //hourly rate of pay
double weeklyWage = 0.00; //weekly wage
//print heading
cout << "Program to calculate weekly gross pay for hourly employees" << endl << endl;
while(true)
{
//prompt user to enter hours and hourly rate
cout << "Enter hours: ";
cin >> hoursWorked;
cout << "Enter hourly rate: ";
cin >> hourlyRate;