problems with looping

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 ?

Thanks
No, this is a job for some do whiles
Pseudocode:
1
2
3
4
5
6
7
8
9
10
11
do
{
   1)
   2)
   do
   {
      ask if correct
   }
   while ( answer != "yes" or "no" ) // validate answer
}
while ( answer != "yes" )
thanks bazzy. sorry for double posting
Topic archived. No new replies allowed.