I am trying to figure out how to reset the code back to the start.
[#include <iostream>
#include <string>
#include <stdlib.h>
usingnamespace 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");
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");
}