Umm yeah I have probably the most rookie mistake been learning c++ for a 2 weeks now need help with this please help. When you enter red and enter New York nothing shows up. Its really frustrating I tried putting a else statement but its not working. I tried putting in (Bobby == "Alabama" || Bobby == "New York")
{ string cheese = "Welcome to " + Bobby + "!";
cout << " Congraulations" << cheese << endl;
but thats not working either help me..
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string name;
cout << "Please enter your name" << endl;
cin >> name;
//Introduction to the game
string greetings ="Hello " + name + "! ";
cout << greetings << "Welcome to our game" << endl;
string choose;
cout << "Choose if you wanna be (blue or red)" << endl;
cin >> choose;
if (choose == "red")
{
cout << "You are a red character" << endl;
}
elseif(choose == "blue")
{
cout << "You are a blue character" << endl;
}
string Bobby;
cout << "Do you wanna go to (Alabama or New York)" << endl;
getline(cin >> ws, Bobby);
if (Bobby == "Alabama")
{
string cheese = " Welcome to " + Bobby + "!";
cout << "Congraulations" << cheese << endl;
}
elseif (Bobby == "New York")
{
string cheese2 = " Welcome to " + Bobby + "!";
cout << "Congraulations" << cheese2 << endl;
}
}
Please enter your name
Fred
Hello Fred! Welcome to our game
Choose if you wanna be (blue or red)
red
You are a red character
Do you wanna go to (Alabama or New York)
New York
Congraulations Welcome to New York!