The following code seems to not work...after the first do while completes it goes on to the second one although the condition isn't met...i tried putting breaks in enclosing it in brackets...i don't know what else to do
i understand what you are say but my teacher of mine wants us to use do..while loops as the primary loop, (we already made the same code with if else statements and while loops)
then I would suggest enclosing the if{} elseif{} statements within a do...while loop that terminates if the user enters 'q' or some char other than 'r' or 'p', or is that not allowed either?
Yeah, the way do/while loops work is basically it says "Okay, do this then test the expression for true or false, if true do the loop again but if false then go to the next line after the while expression". Where as the while loops tests the expression first and if it is true then executes the block, otherwise it skips over the loop.
Either use if statements or make minor changes to the code and use while loops instead if you don't need it to execute before the expression test.