I'm trying to make a script that helps verify a persons age on whether or not someone can go into a bar, then if they can order or not but seem to be having an issue with a "expected primary-expression before '{' token" on line 23.
Here is my code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Hello, what is your name?: "; //asking user for their name string
getline(cin, name);
cout << "Hello, " << name << endl; // output saying hello to the user by their inputted name
int age;
cout << "How old are you," << name << " ? ";
cin >> age;
if (age >= 21)
{
cout << "Welcome " << name << " You can come into the bar!" <<
{
char answer,
cout << "Would you like a drink, " << name << "? Type y for yes n for no." <<;
cin >> answer;
if (answer == 'y');
{
cout << "Here's your drink, " << name << ".";
}
else
cout << "Maybe next time then." << ;
}
}
else
{
cout << "Sorry " << name << " you're too young to be in the bar." << endl;
}
return 0;
}