From 57bf4ed93161691a0cbbba9dfabbb228fe413bd8 Mon Sep 17 00:00:00 2001 From: Ryan Meline Date: Wed, 18 Feb 2026 11:17:48 -0800 Subject: [PATCH 1/3] Typing nothing now terminates program, resolves #96 --- main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index d9884f9..0bf2066 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using std::cout; using std::cin; @@ -22,15 +23,16 @@ int main(){ cout << "What are you listening to?\n"; getline(cin,input); transform(input.begin(), input.end(), input.begin(), [](unsigned char c){ return std::tolower(c); }); - cout << VALIDATION[pick] << "! Let's listen to more\n"; + if(input != "nothing") + cout << VALIDATION[pick] << "! Let's listen to more\n"; - do{ + while( input != "nothing") { cout << "What's next?\n"; getline(cin,input); transform(input.begin(), input.end(), input.begin(), [](unsigned char c){ return std::tolower(c); }); pick = rand() % VALIDATION.size(); cout << VALIDATION[pick] << "!\n"; - }while( input != "nothing" ); + }; return 0; } \ No newline at end of file From 8954c100e493f050057b9beb953ff8aa168de36c Mon Sep 17 00:00:00 2001 From: Ryan Meline Date: Wed, 18 Feb 2026 11:31:45 -0800 Subject: [PATCH 2/3] fixed merge conflicts, resolves #96 --- main.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 0bf2066..44a21b7 100644 --- a/main.cpp +++ b/main.cpp @@ -14,6 +14,8 @@ using std::transform; const vector VALIDATION = {"Cool","Great","Perfect","Beautiful","Aw, yeah"}; +string get_input_in_lowercase(); + int main(){ string input; int pick; @@ -21,18 +23,24 @@ int main(){ srand(time(0)); 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); }); + input = get_input_in_lowercase(); if(input != "nothing") cout << VALIDATION[pick] << "! Let's listen to more\n"; - while( input != "nothing") { + + while( input != "nothing" ) { cout << "What's next?\n"; - getline(cin,input); - transform(input.begin(), input.end(), input.begin(), [](unsigned char c){ return std::tolower(c); }); + input = get_input_in_lowercase(); pick = rand() % VALIDATION.size(); cout << VALIDATION[pick] << "!\n"; }; return 0; +} + +string get_input_in_lowercase(){ + string in; + getline(cin,in); + transform(in.begin(), in.end(), in.begin(), [](unsigned char c){ return std::tolower(c); }); + return in; } \ No newline at end of file From 6a91583ab37d859d191acd9ae4c759051bc4605e Mon Sep 17 00:00:00 2001 From: Ryan Meline Date: Wed, 18 Feb 2026 11:40:15 -0800 Subject: [PATCH 3/3] resolves #96 --- main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 122626b..1d3c289 100644 --- a/main.cpp +++ b/main.cpp @@ -32,7 +32,8 @@ int main(){ cout << "What's next?\n"; input = get_input_in_lowercase(); pick = rand() % VALIDATION.size(); - cout << VALIDATION[pick] << "!\n"; + if( input != "nothing") + cout << VALIDATION[pick] << "!\n"; }; return 0;