I currently have a program which has the following basic structure
main function -- displays menu options to user -- validates user input by passing it to a second function (input_validator) -- if user selects option 1, run function 1, etc
function1,2,3,etc -- input is requested from user and then validated by input_validator -- if input_validator returns true, we know input is good
Here is my problem. I want to allow the user to quit at any point within the program by typing '0'. I planned on doing this with some basic code in input_validator (if input = 0, etc).
This would appear to be simple, but I have been told that using quit() will result in some resources never been released / etc. I cannot simply do a 'break' either -- it will result in my program simply returning to the main function.
Any ideas?