Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
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)
55 changes: 32 additions & 23 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,35 @@ using std::string;
using std::vector;
using std::transform;

const vector <string> VALIDATION = {"Cool","Great","Perfect","Beautiful","Aw, yeah"};

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); });
cout << VALIDATION[pick] << "! Let's listen to more\n";

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();
cout << VALIDATION[pick] << "!\n";
}while( input != "nothing" );

return 0;
}
const vector<string> VALIDATION = {"Cool", "Great", "Perfect", "Beautiful"};

int main() {
string input;
int pick;

srand(time(0));

cout << "What are you listening to?\n";
getline(cin, input);

if (input == "nothing") {
return 0; // Exit immediately if user enters "nothing"
}

pick = rand() % 4;
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;
}