This must be the case for this assignment unfortunately... |
Well your prof needs some bar room diplomacy (get him / her on floor, and sit on them until they agree to do it properly)
With the
std::cout
separate the quoted parts with << , as in :
1 2 3 4 5 6
|
std::cout << "Here is a menu of available wage rate and menu options: "
<< "********************************************************************"
<< "1) $8.75/hr 2) $9.33/hr "
<< "3) $10.00 / hr 4) $11.20 / hr "
<< "5) quit " l
<< "********************************************************************";
|
That code should be in it's own function.
Why are you mixing C++ I/O with C (printf / scanf) ?
If using
scanf
, check the return value to see if it worked.
Put forward declaration of your functions before main, with the function definitions after main. This is so main is near the top of the file.
Try to avoid global variables, they will bite you in the ass one day :+)
Golden Rule: Always initialise your variables to something. Preferably wait until you have a sensible value to assign to it, then do the declaration and assignment all in 1 line.
Rather than magic numbers like 40.00 , 1.50 , 300, 450 in the code, make them
constexpr
variables, and use the variable name instead.
constexpr float OrdinaryHours = 40.0f;
Put comments before the line they apply to, not at the end - they make the line too long.
This is wrong:
else if (300.00 <= gross_pay <= 450.00) {
The reason is that
300.00 <= gross_pay
evaluates to true or false, so then you have
true <= 450.00
, which doesn't make sense.
if (gross_pay >= 300.00 && gross_pay <= 450.00) {