From 99dfee87ae92ae01a6a9b4b9b5eb7edd32374fcf Mon Sep 17 00:00:00 2001 From: winexe0 Date: Fri, 9 Dec 2022 21:31:15 -0800 Subject: [PATCH] Fix bug where CLI closes after encryption/decryption --- src/decrypt.cpp | 2 +- src/encrypt.cpp | 2 +- src/main.cpp | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/decrypt.cpp b/src/decrypt.cpp index 24046bd..801aad1 100644 --- a/src/decrypt.cpp +++ b/src/decrypt.cpp @@ -86,7 +86,7 @@ int decrypt() { newMessage += newCharacter; } } - cout << "Your decrypted message is '" + newMessage + "'" << endl; + cout << "Your decrypted message is '" + newMessage + "'. Press ENTER to exit" << endl; } return 0; } \ No newline at end of file diff --git a/src/encrypt.cpp b/src/encrypt.cpp index 326bfb3..696b2fd 100644 --- a/src/encrypt.cpp +++ b/src/encrypt.cpp @@ -86,7 +86,7 @@ int encrypt() { newMessage += newCharacter; } } - cout << "Your encrypted message is '" + newMessage + "'" << endl; + cout << "Your encrypted message is '" + newMessage + "'. Press ENTER to exit" << endl; } return 0; } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index cf88f60..4420a92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,8 @@ int main(int argc, char** argv) { if (crypt == "decrypt") { decrypt(); } + cin.ignore(); + cin.get(); } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu