From 662d85ee77cea7ba6670f95f6fc4eacbdf8d7488 Mon Sep 17 00:00:00 2001 From: OlekS03 Date: Wed, 24 Sep 2025 11:24:27 -0700 Subject: [PATCH 1/3] Always terminate upon "nothing" fix #1 --- main.cpp | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/main.cpp b/main.cpp index 982d05f..ea55894 100644 --- a/main.cpp +++ b/main.cpp @@ -9,24 +9,35 @@ using std::endl; using std::string; using std::vector; -const vector VALIDATION = {"Cool","Great","Perfect","Beautiful"}; +const vector VALIDATION = {"Cool", "Great", "Perfect", "Beautiful"}; -int main(){ - string input; - int pick; +int main() { + string input; + int pick; - srand(time(0)); - pick = rand() % 4; - cout << "What are you listening to?\n"; - getline(cin,input); - cout << VALIDATION[pick] << "! Let's listen to more\n"; + srand(time(0)); + + cout << "What are you listening to?\n"; + getline(cin, input); + + if (input == "nothing") { + return 0; // Exit immediately if user enters "nothing" + } - do{ - cout << "What's next?\n"; - getline(cin,input); pick = rand() % 4; - cout << VALIDATION[pick] << "!\n"; - }while( input != "nothing" ); + cout << VALIDATION[pick] << "! Let's listen to more\n"; + + do { + cout << "What's next?\n"; + getline(cin, input); + + if (input == "nothing") { + break; // Exit loop if user enters "nothing" + } + + pick = rand() % 4; + cout << VALIDATION[pick] << "!\n"; + } while (true); - return 0; -} \ No newline at end of file + return 0; +} From e7a9a798cfd8712059bcfeff53fa0f9021fbc9ed Mon Sep 17 00:00:00 2001 From: OlekS03 Date: Wed, 24 Sep 2025 11:40:54 -0700 Subject: [PATCH 2/3] Create compile.yml fix #2 --- .github/workflows/compile.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/compile.yml diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 0000000..e2018ac --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,20 @@ +name: compile + +on: + pull_request: + branches: + - main + push: + branches: + - devops + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Compile application + run: g++ -std=c++17 main.cpp From dce3eb92f84fea0f2f19a965eb8fc9f54d92bac0 Mon Sep 17 00:00:00 2001 From: OlekS03 Date: Wed, 24 Sep 2025 11:47:34 -0700 Subject: [PATCH 3/3] README.md fix #2 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bbcf55a..92c6b8a 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,6 @@ I like that app too! -This repo is compatible with the [cpp-container docker container](https://github.com/ChicoState/cpp-container). \ No newline at end of file +This repo is compatible with the [cpp-container docker container](https://github.com/ChicoState/cpp-container). + +![Compile](https://github.com/OlekS03/autovalidate/actions/workflows/compile.yml/badge.svg)