You have two variables runningTotal and totalCost which seems to be the same. You do nothing with runningTotal except for printReceipt(...) (lines 36/39). So I'd say remove runningTotal and use just totalCost.
The problem with totalCost is that you do not initialize it. When you add a value (like on line 29) the result remains garbage.
How would I go about fixing that? I took out runningTotal and replaced it with totalCost but it still says my running total = 0 in the receipt. I'm really at my wit's end here trying to figure this out.
Hi, I have also just started learning C++ and have picked out a few things I noticed, please correct me if any of the below is wrong however!
1. showMenu function doesn't actually require any parameters, it just causes you to pass an uninitialised variable (menuSelection), which also becomes redundant now so can be removed.
2. If you remove the argument for showMenu you will need to declare choice as a local variable inside the function
3. You should initialise the variable totalCost to 0 when declaring it, as you are calling it in your switch statement uninitialized
4. I would try to use the same parameter names in your function prototypes for consistency. Your prototype for printReceipt passes finalPrice and discountRate, but your actual function passes them as totalCost and discountRate
5. It doesn't appear to be applying the discount as the discountRate returned from the getDiscountRate function isn't applied to a variable