diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..4eb8e12 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,23 @@ +name: Build C++ + +on: + push: + branches: "anthonybranch" + pull_request: + branches: [ main ] + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y -f build-essential g++ cmake + build: + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build project + run: g++ -std=c++17 main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a85cd0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +a.out +*.out diff --git a/README.md b/README.md index bbcf55a..8c1b9eb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # autovalidate +[![Build C++](https://github.com/DilyCantCode/autovalidate/actions/workflows/actions.yml/badge.svg)](https://github.com/DilyCantCode/autovalidate/actions/workflows/actions.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 old mode 100644 new mode 100755 index 690cf17..30695b3 --- a/main.cpp +++ b/main.cpp @@ -5,6 +5,7 @@ #include #include +using namespace std; using std::cout; using std::cin; using std::endl; @@ -14,8 +15,6 @@ using std::transform; const vector VALIDATION = {"Cool","Great","Perfect","Beautiful","Aw, yeah"}; -string get_input_in_lowercase(); - int main(){ string input; int pick; @@ -23,22 +22,22 @@ int main(){ srand(time(0)); pick = rand() % VALIDATION.size(); cout << "What are you listening to?\n"; - input = get_input_in_lowercase(); + getline(cin,input); + transform(input.begin(), input.end(), input.begin(), [](unsigned char c){ return std::tolower(c); }); + if (input == "nothing"){ + return 0; + } else { + cout << "Nothing? That's not very good for you.\n"; + } cout << VALIDATION[pick] << "! Let's listen to more\n"; do{ cout << "What's next?\n"; - input = get_input_in_lowercase(); + 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; } - -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