syashsing234, are you running
or are you running
(msg1028200)'s code is supposed to fail and cause a runtime exception. Chervil's first post (msg1028137) is what works on my machine (MinGW g++ 7.1.0, Windows 10), and should work on your machine (if Windows and MinGW), too.
Edit: I see you said you are using the pop_back code.
Are you sure you're running the code verbatim?
Are you getting any compiler warnings?
What name+version is the compiler you downloaded with Code::Blocks?
Is the program crashing, or does it just hang at getch()?
An alternative to the ancient getch would probably have to come from a library that hides part of the console, such as ncurses. But I am not familiar with, so sorry if this post is useless.