"error after default cout has an error"
Is not very helpful!
All that says is that your incoming data contains value that when divided by 100 is not in your list of known instructions.
Suggestions:
Modify the
default
error report to give more information:
i So you know which line inyour input has the error
memory[i] So you know the raw data which causes it.
opCode So you know what value the switch statement is trying (and failing) to find
operand For completeness.
I would additionally output the accumulator, and provide an optional memory dump so that I could see a shapshot of the faulty program if I needed it.
I would create a routine to provide all this, so I could do it whenever I had a problem, and probably add a "Continue execution anyway?" question.