I need to make this program go back to entering your name when you hit "n" or "N", but continue if you hit "y" or "Y"
Help please??
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
char name[20];
cout <<"Enter your name:" << endl;
cin.getline(name, 20);
cout <<"\nYou have chosen the name: " << name << endl;
cout <<"\nIs this correct?\n<Y/N>\n" << endl;
char yn;
cin >> yn;
if (yn == 'y' || yn == 'Y')
cout <<"\nThen let's move on...\n" << endl;//continue program if user enters "Y or y"
else if (yn == 'n' || yn == 'N')
cout <<"\nWell then, what is it?\n" << endl;//loop back to start if user enters "N" or "n"
system("pause");
return 0;
}
