BullCowGame.exe has triggered a breakpoint

When I run the application with no errors it is crashing. When debugging it says “Exception Thrown, BullCowGame.exe has triggered a breakpoint”. When running without debugging it says “Expression: string subscript out of range”. Seeing if it was a problem with my code I’ve copied the exact code from -

However the problem still persists. Any help would be appreciated.

It happens if you type (guess) a word shorter (by at least two chars according to std::string::length implementation) then the hidden word .
To fix this - inside PlayGame in main.cpp Guess should be checked to make sure it is not too short. It would be a simple if statement.

Privacy & Terms