Hello There!! I am having some trouble with 'if...else' statement. Supposed to show price for medium or large pizza with no coupon, medium or large pizza with coupon, invalid size pizza (must be L or M). For some reason, the program only calculates L - 2.00 correctly....
using namespace std;
3) The conditional block for medium-with-coupon is exactly the same as for large-with-coupon. Why two separate blocks here, when one would do?
4) You're trying to use the variable coupon to mean two different things - the amount of the discount, and the user Y/N input for whether they have one. You'll need two different variables for these two different things.
5) ... and then you should actually use the variable containing the discount value in the calculation. Scattering magic numbers about the code is generally not a good idea; it reduces maintainability and readability.
Hello @coder777 & @MikeyBoy. Thank you for the feedback!! Though I am still having issues. I did not quite understand "3) The conditional block for medium-with-coupon is exactly the same as for large-with-coupon. Why two separate blocks here, when one would do?"
Is it possible to show me how it's supposed to look like? I cannot find any examples from my textbook nor a similar example online...