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 must compare it to a string, or at least a const char * or const char[].
The expression lastTwoChars == 41 compares lastTwoChars to 41--an int. This is not defined behavior for a string.
Instead, put 41 in quotes to make it a const char[] (specifically const char[3]):
if (lastTwoChars == "41")
It looks like you do this several times in your code.