Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A generic function to close win32 console applications
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #include <string>
- using namespace std;
- void closeApp();
- int main() {
- closeApp();
- return 0;
- }
- // application termination function
- void closeApp() {
- // local variables
- bool inputSafe = false;
- string reply;
- string accept = "q";
- while (!inputSafe == true) {
- cout << "Please enter q to exit the application: ";
- cin.clear();
- getline(cin, reply);
- if (reply == accept) {
- inputSafe = true;
- exit(1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement