Suppose I wanted a particular key, lets say 4 to exit the program. How would I go about that? More along the lines of cases. By that I mean this is an if case where it just exits the program.
if(x==1)
.....something happens....
if(x==2)
.....something happens....
if(x==3)
.....something happens....
if(x==4)
// The program exits out
I suppose you're referring to a menu of some sort. Da0omph's example of return 0; will exit the application. When main() runs into the first return statement, it exits, but if x doesn't equal 4, it will finish running the program until it hits the last return 0; statement.