So start with the debugger, and try to find out why!
Put a breakpoint on the line:
int p=compare(s,choice2);
And run your app in the debugger. When it gets to that line, it'll stop and wait for you to tell it what to do.
Use the debugger to look at exactly what is in the various variables and work out exactly what should happen when you execute the next line before you execute it. Did it do exactly what you expected? If so, move on to the next. If not, why not? What did it do that you didn't expect, or not do that you did?
This is a skill - predictably called debugging - and like all skills you only develop it by using it. And it's a lot easier to learn it on a simple app like this than a 100,000 line behemoth written by someone else! :laugh:
So give it a try, and see what you can find out.