Resetting game

I am trying to reset the game until the user puts in the correct name. How do I do that?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  I am trying to figure out how to reset the code back to the start. 

[#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;

int main()
{
string name;
string Yes;
string No;
cout << "Enter your name.";
cin >> name;
cout << "You entered: " << name << endl;
cout << "Is this correct?" << endl;
cout << "Enter Y for yes or N for no." << endl;
cin >> Yes;

if(Yes == "Y")
{
cout << "Welcome to your story" <<endl;
system("PAUSE");
}
else{
cout << "Reenter name" << endl;
system("PAUSE");
system("CLS");
//restart here and keep restarting till name is correct
}



system("CLS");
cout << "Our story starts off on a wonderful July evening." << endl;






}
]
This is what I have so far. Everything else is running just like I want it besides that part. 
do
{
cout << "Enter your name.";
cin >> name;
cout << "You entered: " << name << endl;
cout << "Is this correct?" << endl;
cout << "Enter Y for yes or N for no." << endl;
cin >> Yes;
} while(Yes != "Y");
Last edited on
Enter your name.ad
You entered: ad
Is this correct?
Enter Y for yes or N for no.
N
Please reenter your name
Press any key to continue . . .
Please reenter your name
Press any key to continue . . .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    string name;
    string Yes;
    string No;
    cout << "Enter your name.";
    cin >> name;
    cout << "You entered: " << name << endl;
    cout << "Is this correct?" << endl;
    cout << "Enter Y for yes or N for no." << endl;
    cin >> Yes;

while(Yes != "Y")
    {
    cout << "Please reenter your name" <<endl;
    system("PAUSE");
    }


It won't let the user and a new name


Nvm I just relized I dont have the code allowing for the user to reenter their name.
Topic archived. No new replies allowed.