Needs help about strings and if and else .
using namespace std;
int main ()
cout << "What's your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
Was trying to make a program which should say "Hi bro" to john and hello to any else,but when i try this if thing,it gives an error saying that john was not declared.Please help.
Where have you defined your variable named john?
I think you meant
if ( mystr == "john" )
ty vlad,i forgot to use "" =P,tyvm