How can I get a y or n answer from the user without messing with newline character.
The following code fails in this because the second getchar gets the newline character from the previous answer:
Thank you.Code:do { result = play_game(); if (result == true) { printf("\nYou win!"); wins++; printf("\n\nPlay again?"); ch = getchar(); } else { printf("\nYou lose!"); losses++; printf("\n\nPlay again?"); ch = getchar(); } } while (ch != 'n');