diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bfa3065 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +name: compile + +on: + push: + branches: '**' + pull_request: + branches: [cicd] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: compile + run: g++ -std=c++17 main.cpp diff --git a/README.md b/README.md index bbcf55a..a3b34b0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # autovalidate +[![Build C++](https://github.com/apartridge16/autovalidate/actions/workflows/build.yml/badge.svg)](https://github.com/apartridge16/autovalidate/actions/workflows/build.yml) + 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). diff --git a/main.cpp b/main.cpp index d9884f9..ea2d551 100644 --- a/main.cpp +++ b/main.cpp @@ -4,33 +4,38 @@ #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"}; -int main(){ +int main() +{ string input; int pick; 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); }); + getline(cin, input); + if (input == "nothing") + return 0; + cout << VALIDATION[pick] << "! Let's listen to more\n"; - do{ + do + { 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(); + getline(cin, input); + if (input == "nothing") + break; + pick = rand() % 4; cout << VALIDATION[pick] << "!\n"; - }while( input != "nothing" ); + } while (input != "nothing"); return 0; } \ No newline at end of file