How to allow user input to exit the program?

I need to create a command where the user inputs a character and it'll exit out the program rather than executing any of the other code.

For example :

If I wanted to do like

char key;

if (key == D || key == d)


What would I need to put in between those brackets under the if statement to allow the user to enter the letter D and it would close out the program?
Last edited on
Topic archived. No new replies allowed.