If statement isn't working when I change "UnitedStates" as "United States". What is the reason of that? Why space character cannot be read correctly? What should I do? If you could help me to understand, I'd be grateful.
int main()
{
string u1 = "UnitedStates";
string a1;
cout << "Country: ";
cin >> a1;
if (a1 == u1)
cout << "Congrats!";
return 0;
}
int main()
{
string u1 = "United States";
string a1;
cout << "Country: ";
cin >> a1;
if (a1 == u1)
cout << "Congrats!";
return 0;
}
I tried so many times.