What is the best way to compare strings in c++
I've done something along the times of
char stringa[10];
char stringb[10] = "pick";
cout << "Enter code";
cin >> stringa;
if (stringa == stringb)
{
cout << "Match!";
}
else
{
cout << "No Match!";
}
but no matter what, it's always a no match. Now, obviously this isn't the entire code, and is without formatting, but the meat of the matter is there.
any suggestions?
I've done something along the times of
char stringa[10];
char stringb[10] = "pick";
cout << "Enter code";
cin >> stringa;
if (stringa == stringb)
{
cout << "Match!";
}
else
{
cout << "No Match!";
}
but no matter what, it's always a no match. Now, obviously this isn't the entire code, and is without formatting, but the meat of the matter is there.
any suggestions?
