C++ if and bool

Hi, I am trying to make a program to verify if you are a US Citizen or not. How can I do so and what is wrong with my code? Thanks for all answers in advance.

string isCitizen;
cout << "Are you a US citizen?: ";
cin >> isCitizen;
string yes;
if (isCitizen == “Yes”)
bool yes = true;
else bool yes = false;

cout << boolalpha << yes;

You cannot change the type of a variable as you have done with the yes variable. You would need to create a separate variable (like yesBool) or rename the one you took as input (eg. response).

2 Likes