Im getting 2 of these warning message upon compiling the programme below. Cant figure out why. can someone help please?
warning C4700: local variable 'rate_of_pay' used without having been initialized
warning C4700: local variable 'hours' used without having been initialized
Question
Develop a C++ program that uses a while structure to determine the gross pay for each of several employees. The company pays "flat-rate" for the first 40 hours worked by each employee and pays “1.5 times flat rate” for all hours worked in excess of 40 hours. Your program should prompt the user for information on each employee (as shown below) and should determine and display the employee’s gross pay. A terminator should end the input prompt loop. You only need to enter enough employees and their details to demonstrate the program operation.
#include <iostream>
using namespace std;
int main ()
{
int hours, rate_of_pay, salary_with_overtime, salary_without_overtime;
salary_without_overtime = rate_of_pay * hours;
salary_with_overtime = (40 * rate_of_pay) + ((hours - 40)* 1.5 * rate_of_pay);
do {
cout << "Enter total number of hours worked : ";
cin >>hours;
cout << "Enter hourly rate of worker : ";
cin >> rate_of_pay;
if (hours <= 40) {
cout <<"Salary is : "<< salary_without_overtime<<endl;
}
else {
cout <<"Salary is : " <<salary_with_overtime<<endl;
}
} while (hours >0);
return 0;
}