I am trying to make a while loop that exits when the user inputs the word "done" - however it loops endlessly. I am sure this is something simple that I am missing.. but its giving me a headache.
char name[50];
cout << "Enter steven ";
getline( cin, name );
if ( name == "steven" )
{
cout << "Your name is steven\n";
}
You can't make type changes and presume that the original case still applies.
checkItem (as does name above) degrades to a pointer to char -- for the purposes of this discussion you can just say it is a pointer to char.
Your name is a std::string, which has the equality operator == overloaded so that it can execute a function when the user says foo == "x" -- it is about the same as foo.compare( x ).
That's a world of difference.
Ah, I see your edit. (Sorry, I can be slow...) Yes, this is why. Hope this helps.