I'm working on a C++ project. I gave the user the option to exit from the program by entering 'q' when asked to enter a command in the console window. I've looked around StackOverflow and came across exit(). Apparently using exit is actually a quite bad way of ending the program. I'm not sure if it's because it abruptly aborts without time for the program to round up things. I'd rather not take the easy way and actually learn something here so which is the best way to exit a program in c++. Here is a snippet of the code.
else if (operation == "q"){
}
Operation variable is the user's input. Thanks in advance