#include <iostream>
#include <string>
#include <windows.h>
using std:: cout;
using std:: cin;
using namespace std;
int main()
{
unsigned long n;
char Answer;
string mystr;
do {
do {
cout << " What is your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is one of your hobbies? ";
getline (cin, mystr);
cout << "Cool, I also like " << mystr << "!\n";
cout << "Can you guess my name? ";
getline (cin, mystr);
cout << "Haha, good guess " << mystr << " that is funny, trick question I do not have a name! \n";
cout << "Do you like parkour?(y/n)? ";
cin >> Answer;
if(Answer == 'y' || Answer == 'Y')
cout << "\nYou have been promoted to cool.\n";
cout << "\nDo you want to do it again? (y/n)";
cin >> Answer;
} while (Answer == 'y' || Answer == 'Y');
if(Answer == 'n' || Answer == 'N')
cout << "\nDo you know what it is?(y/n)? ";
cin >> Answer;
if(Answer == 'y' || Answer == 'Y')
cout << "\nGood.";
if(Answer == 'n' || Answer == 'N')
cout << "\nGo and Google it, then talk to me again.";
cout << " I am tired, I will go to sleep now. \n";
cout << "Do you want to do it again? (y/n)";
cin >> Answer;
} while ( Answer == 'y' || Answer == 'Y');
return 0;
}
I need help to make my program loop back in two places. It loops at the end but I do not know how to make it loop in the middle.
cout << "\nDo you want to do it again? (y/n)";
cin >> Answer;
} while (Answer == 'y' || Answer == 'Y');
I am a noob and this is the first program i have written without using a book all help and pointers weclome :)