The code you posted is not the real code, but chances are that the omission of a setlocale
call reflects a similar omission in the real code.
So that's one thing to do, add a setlocale( LC_ALL, "" )
call at the start of main
.
You should also take care to trim (remove undesired whitespace from) your input string, and to check whether there are any characters left after that, at all.
Also, the assignment in
if (detector = 0)
is most probably a typo.
Liberal use of const
can help avoid such, and also the (in my opinion misguided, because it reduces readability) practice of writing the constant first in a comparison.
Also, using integers as boolean, instead of the bool
type, as you apparently do, is ungood practice.