I am writing a program in which the user enters a number between 1 and 3 (3 meaning that he/she would like to quit) and I am using a switch function within a do-while loop. I am trying to get the program to end the loop when the user enters the number 3. However, my program is only continuing the loop when the user enters 3. Can anyone help me fix this please? Thanks so much!


Follow the logic flow line by line, you are asking for the user to enter the price for the item after they make the choice between 1,2, or 3 regardless of which choice they made.

The do...while loop involving the switch statement doesn't come into play until after the user has entered a price. So unless they enter a price of 3, this will never exit.