Hello, I've written a program where I ask for a name which I've given a list of name for and then I return their birthdate. I then ask the user if they would like to enter another name for a birthdate but this is where I can't figure out how to do it? When I run the code below it asks for a name, it displays their birthday - it asks if they want to enter another name and when I reply y - it starts the program again but doesn't let me enter another name it prompts the user if they wanna run the program again? I'm lost at this point - is bool goon=true the correct way to do this?
#include<iostream>
#include<string> // gives you string functions
#include <cstdlib>
#include<ctime>
usingnamespace std;
char answer;
int main()
{
bool goOn=true;
while(goOn)
{
cout<< "Programmer: Edgar" << endl;
cout<< "Program name: Family birthday" << endl;
cout<< "Program birthdate: 8/15/2013" <<endl << endl <<endl << endl;
cout << "Type a Name below as shown & I will give you their birthdate: " <<endl;
cout << "Crystal Sean Scott Diana Jara" <<endl <<endl;
string input;
cout << "Enter a name: ";
getline(cin, input);
if (input == "Crystal")
{
cout<< "6/4/1986";
}
if (input == "Scott")
{
cout<< "10/16/1986";
}
if (input == "Sean")
{
cout<< "10/11/1983";
}
if (input == "Diana")
{
cout<< "8/18/1989";
}
if (input == "Jara")
{
cout<< "8/18/1989";
}
cout << endl << endl;
cout<<"Would you like to enter another name: ? Enter y or n: ";
char answer;
cin>>answer;
if(answer!='y')
{
goOn=false;
cout<<"thanks for playing!"<<endl;
}
}
return 0;
}Put the code you need help with here.