I have no idea what to do

I followed the video exactly, and my program still gets an error once the user types in less than 6 words.

Expected outcome:
Loop until user enters a correct input

This error appears:

Debug Assertion Failed!

Program: C:\Windows\system32\MSVCP140D.dll
File: c:\program files (x86)\microsoft visual
Line: 3148

Expression: string subscript out of range

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug application)

1 Like

Without looking at your code, I have a strong suspicion that you missed a break;

Make sure you have a break after each case and then that you have a default: return Guess at the end.

What this does is that if the guess has something wrong with it (length, not isogram, etc), the message will print out, the program will see “break” and break out of the switch, and then the program will see while (Status != EGuessStatus::OK) and go back to the top of the loop. This will keep happening until a valid guess is entered. Each case will be checked, and none of them will be problems so the “default” block will run and return the Guess.

That leads me to the other thing that could be wrong with your code: you might not be catching an error, and so the default case is being run and the invalid guess is being returned.


Hello dear @Jackson123,

please provide your code here in the forum or on GitHub, so I can analyze where the problem is.

Kind regards

Privacy & Terms