Writing a simple code and ran into a problem I\'m not sure how to deal with. I tried looking into it with a search but nothing I found was much help and everyone\'s answers wer
lastTwoChars
is a string, you are comparing it with an int in these statements :
if (lastTwoChars == 41)
{
cout << "Red";
}
if (lastTwoChars == 25)
{
cout << "Black";
}
if (lastTwoChars == 30)
{
cout << "Green";
}
This is against the defined behaviour for string. You have to compare it to a string or char*.
if (lastTwoChars == "41")
{
}
cout << "Red";
.
.
.
Now "41"
is a const char* in this case and it can be compared with a string or a char*.