Prevent "'Sigkill' to stop program

Hello everyone!

So I have been learning C++ for about 5~ weeks now or so, and I have created some simple programs such as a math problem generator.

http://pastebin.com/KHSwh49H Please excuse the messy code. ( Kind of a mix of code from somewhere I found online )

I've recently shown this to my friend and he was impressed. While playing around will it, he said, "I know how to crash your program."

And he proceed to enter the following in "sigkill" and It stops the program.
I was surprised that it worked and started searching online on how to fix this issue. There were 2 posts I saw that might help but the code they used was way too complicated for me to understand.

My friend claims he knows more "kill code."

Is there anyway I could prevent this from happening? I've tried to add in cin.clear() and cin.ignore() but It didn't work.

Thank you
No, you cannot prevent SIGKILL from killing your program.

See:
https://linux.die.net/man/7/signal
https://linux.die.net/man/2/sigaction
Last edited on
Topic archived. No new replies allowed.