I have a c++ problem regarding looping. I am writing a program which will include a problem similar to below.
1) ok, i am writing a program that asks the user to enter a number.
2) Then ask the user if the number entered was correct.
3) If the number is correct, the user will enter 'y' or 'yes' and the program will terminate. (pretty simple so far ?)
4) If the user enters 'n' or 'no' the program should loop back to the beginning of the program and start again. goes back to 1)
5) However, if the user enters anything other than 'yes' or 'no', the program rejects this input and tells the user to re-enter, using only 'yes' or 'no'.
6) This should be asked infinitely until either 'yes' or 'no' is inputted, after which the program then loops back to the beginning. how would i do this ?
i've been trying do while and switch but no luck. would i have to use a for loop ?