Any Suggestions For why this won't debug properly.
//displays the weekly gross pay for any employee
#include <iostream>
using namespace std;
int main()
{
std::cout << "\nHourly workers pay:\n";
//Get hourly rate
std::cout << "Hourly rate: $";
double rate;
std::cin >> rate;
//Get hours worked
std::cout << "Hours worked: ";
double hours;
std::cin >> hours;
//calculate pay
double pay;
//check for overtime
if(hours > 40.0)
{
//standard rate
pay += rate * 40;
//overtime rate
pay += (rate * 1.5) * (hours - 40);
}
else
pay += rate * hours;
//results
if(std::cin.good())
std::cout << "The hourly workers pay is: $" << pay << "\n" << std::endl;
return 0;
}
I keep getting this code and a error.
1>------ Build started: Project: Introductory 18 Project, Configuration: Debug Win32 ------
1> Introductory18.cpp
1>c:\cpp8\chap 07\introductory 18 project\introductory 18 project\introductory18.cpp(30): warning C4700: uninitialized local variable 'pay' used
1> Introductory 18 Project.vcxproj -> C:\Cpp8\Chap 07\Introductory 18 Project\Debug\Introductory 18 Project.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
@tennisnash2
I believe the reason for your program not running, was given to you by the error codes
1>c:\cpp8\chap 07\introductory 18 project\introductory 18 project\introductory18.cpp(30): warning C4700: uninitialized local variable 'pay' used
Initialize the variable pay
pay = 18.50; or whatever..
How would I fix this error code.