[Solved] While loop only exiting after conditions are met twice in a row [closed]


As @Doorknob 冰 noted, you’re asking for the input twice. The first time you ask for it you don’t actually do anything with it, so that’s why it seems to do nothing, although that’s exactly what you coded it to do.

I suggest you think about what you actually want: the program should receive user input at least once and then verify that it’s a valid position. If it is valid, the while loop exits.

This is exactly what a do{ stuff } while(condition); loop is for.

solved While loop only exiting after conditions are met twice in a row [closed]