From 0eccd17f4e66ba8d3856d85e00872177122c0926 Mon Sep 17 00:00:00 2001 From: Joey Date: Wed, 18 Feb 2026 11:29:24 -0800 Subject: [PATCH 1/3] Fixed the bugs: program should now quit on nothing. Fixes #96 --- main.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/main.cpp b/main.cpp index c9679c7..6726c43 100644 --- a/main.cpp +++ b/main.cpp @@ -3,19 +3,21 @@ #include #include #include +#include -using std::cout; using std::cin; +using std::cout; using std::endl; using std::string; -using std::vector; using std::transform; +using std::vector; -const vector VALIDATION = {"Cool","Great","Perfect","Beautiful","Aw, yeah"}; +const vector VALIDATION = {"Cool", "Great", "Perfect", "Beautiful", "Aw, yeah"}; string get_input_in_lowercase(); -int main(){ +int main() +{ string input; int pick; @@ -23,21 +25,30 @@ int main(){ pick = rand() % VALIDATION.size(); cout << "What are you listening to?\n"; input = get_input_in_lowercase(); + if (input == "nothing") + { + return 0; + } cout << VALIDATION[pick] << "! Let's listen to more\n"; - do{ + do + { cout << "What's next?\n"; input = get_input_in_lowercase(); + if (input == "nothing") + break; pick = rand() % VALIDATION.size(); cout << VALIDATION[pick] << "!\n"; - }while( input != "nothing" ); + } while (input != "nothing"); return 0; } -string get_input_in_lowercase(){ +string get_input_in_lowercase() +{ string in; - getline(cin,in); - transform(in.begin(), in.end(), in.begin(), [](unsigned char c){ return std::tolower(c); }); + 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 69de39d180d054dc2e37d65aa027cd389c84b847 Mon Sep 17 00:00:00 2001 From: Joey Date: Wed, 18 Feb 2026 11:36:39 -0800 Subject: [PATCH 2/3] Add CI workflow. Fixes #95 --- .github/workflows/build.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e69de29 From 8ab347fa7806fbbeec3c632fdd52a392a4ad16cf Mon Sep 17 00:00:00 2001 From: Joey Date: Wed, 18 Feb 2026 11:55:40 -0800 Subject: [PATCH 3/3] Fix CI yaml syntax --- .github/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e69de29..3bcda02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -0,0 +1,13 @@ +name: C++ Build + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Compile + run: g++ main.cpp -o autovalidate \ No newline at end of file