From 7b538c9a10667a97e8806cbd241c4de075769b71 Mon Sep 17 00:00:00 2001 From: Kevin Buffardi Date: Tue, 30 Sep 2025 15:53:01 -0700 Subject: [PATCH] Terminates whenever the user enters 'nothing', closes #1 --- main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.cpp b/main.cpp index d9884f9..8e58755 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using std::cout; using std::cin; @@ -21,13 +22,20 @@ int main(){ pick = rand() % VALIDATION.size(); cout << "What are you listening to?\n"; getline(cin,input); + transform(input.begin(), input.end(), input.begin(), [](unsigned char c){ return std::tolower(c); }); + if( input == "nothing" ){ + return 0; + } cout << VALIDATION[pick] << "! Let's listen to more\n"; do{ cout << "What's next?\n"; getline(cin,input); transform(input.begin(), input.end(), input.begin(), [](unsigned char c){ return std::tolower(c); }); + if( input == "nothing" ){ + return 0; + } pick = rand() % VALIDATION.size(); cout << VALIDATION[pick] << "!\n"; }while( input != "nothing" );