Strings Confusion

I just get lost with strings, I'm not even coding with it right now, I need some people to just explain it to me. Whenever I do try coding with it, only the first character makes it through or I get compiling errors reading:

could not convert `(&Spell)>std::basic_string<_CharT,_Traits,_Alloc>::operator= [with _CharT = char, _Traits=std::char_traits<char>,_Alloc=std::allocator<char>](((const char*)"Alex"))' to `bool'

I usually try to use the strings with conditional statements, like if's.

1
2
3
4
5
6
if(name="Alex"){
cout << "Hello, Alex." << endl;
}
else{
cout << "You're not Alex! Get off this computer!" << endl;
}
Last edited on
You are using '=' instead of '=='.
I'm gonna need a bit more information on strings than that =/
edited:
1
2
3
4
5
6
if(name=="Alex"){
cout << "Hello, Alex." << endl;
}
else{
cout << "You're not Alex! Get off this computer!" << endl;
}
Last edited on
You're gonna have to give a bit more information than that if you want more help. The clip you've posted is fine.
Post the code you wrote which created that error above, if you still have i or can remember it.
Topic archived. No new replies allowed.