From d1c33776b322db74aba070938b8a769d27cb14db Mon Sep 17 00:00:00 2001 From: leomalinen04 Date: Wed, 11 Sep 2024 11:39:30 -0700 Subject: [PATCH 1/9] multiplication feature --- main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.cpp b/main.cpp index 08dfcf5..458110d 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,8 @@ int main(){ std::cout<< (first+second) << std::endl; std::cout<< "Subtraction: "<< first << "-" << second << "="; std::cout<< (first-second) << std::endl; + std::cout<< "Subtraction: "<< first << "*" << second << "="; + std::cout<< (first-second) << std::endl; return 0; } \ No newline at end of file From ec025bf9ab2c7d486ad43978071860ef5fbe106a Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 14:39:06 -0700 Subject: [PATCH 2/9] added workflow folder --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d8fbe2a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +#include + +using std::cout; +using std::cin; +using std::endl; + +int main(){ + double first, second; + + cout<< "First number: "; + cin>> first; + cout<< "Second number: "; + cin>> second; + + cout<< "Addition: "<< first << "+" << second << "="; + cout<< (first+second) << endl; + cout<< "Subtraction: "<< first << "-" << second << "="; + cout<< (first-second) << endl; + cout<< "Multiplication: "<< first << "*" << second << "="; + cout<< (first*second) << endl; + + return 0; +} \ No newline at end of file From 725ab43a3a410d2fa7abb87b35566c8421466817 Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 14:42:23 -0700 Subject: [PATCH 3/9] no spaces --- .github/workflows/main.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d8fbe2a..f00932b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,19 +5,17 @@ using std::cin; using std::endl; int main(){ - double first, second; +double first, second; +cout<< "First number:"; +cin>> first; +cout<< "Second number:"; +cin>> second; - cout<< "First number: "; - cin>> first; - cout<< "Second number: "; - cin>> second; - - cout<< "Addition: "<< first << "+" << second << "="; - cout<< (first+second) << endl; - cout<< "Subtraction: "<< first << "-" << second << "="; - cout<< (first-second) << endl; - cout<< "Multiplication: "<< first << "*" << second << "="; - cout<< (first*second) << endl; - - return 0; +cout<< "Addition: "<< first << "+" << second << "="; +cout<< (first+second) << endl; +cout<< "Subtraction: "<< first << "-" << second << "="; +cout<< (first-second) << endl; +cout<< "Multiplication: "<< first << "*" << second << "="; +cout<< (first*second) << endl; +return 0; } \ No newline at end of file From f0ecc868a6dd8209def8137cd2bc9a8f2f3bc46c Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 14:43:19 -0700 Subject: [PATCH 4/9] no spaces 2 --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f00932b..26a4bb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,11 +11,11 @@ cin>> first; cout<< "Second number:"; cin>> second; -cout<< "Addition: "<< first << "+" << second << "="; +cout<<"Addition:"<< first << "+" << second << "="; cout<< (first+second) << endl; -cout<< "Subtraction: "<< first << "-" << second << "="; +cout<< "Subtraction:"<< first << "-" << second << "="; cout<< (first-second) << endl; -cout<< "Multiplication: "<< first << "*" << second << "="; +cout<< "Multiplication:" << first << "*" << second << "="; cout<< (first*second) << endl; return 0; } \ No newline at end of file From ec879127ee42dfd345260bacbba4b72f45e75fc6 Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 14:47:20 -0700 Subject: [PATCH 5/9] tictactoecode --- .github/workflows/main.yml | 91 +++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26a4bb4..1369f37 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,21 +1,78 @@ -#include +#simple tictactoe code from a friend -using std::cout; -using std::cin; -using std::endl; +include +using namespace std; + +char board[3][3]={{'1','2','3'},{'4','5','6'},{'7','8','9'}}; +char current_marker; +int current_player; + +void drawBoard(){ + cout<>marker_p1; + current_player=1; + current_marker=marker_p1; + drawBoard(); + int player_won; + for(int i=0;i<9;i++){ + cout<<"It's player "<>slot; + if(slot<1||slot>9){ + cout<<"Invalid slot! Try again.\n"; + i--; + continue; + } + if(!placeMarker(slot)){ + cout<<"Slot occupied! Try again.\n"; + i--; + continue; + } + drawBoard(); + player_won=winner(); + if(player_won==1){cout<<"Player 1 wins!\n";break;} + if(player_won==2){cout<<"Player 2 wins!\n";break;} + swapPlayerAndMarker(); + } + if(player_won==0)cout<<"It's a tie!\n"; +} int main(){ -double first, second; -cout<< "First number:"; -cin>> first; -cout<< "Second number:"; -cin>> second; - -cout<<"Addition:"<< first << "+" << second << "="; -cout<< (first+second) << endl; -cout<< "Subtraction:"<< first << "-" << second << "="; -cout<< (first-second) << endl; -cout<< "Multiplication:" << first << "*" << second << "="; -cout<< (first*second) << endl; -return 0; + game(); } \ No newline at end of file From 31f68e3ef42fe3a7a64c7099dadda7c4c76243f7 Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 14:48:07 -0700 Subject: [PATCH 6/9] nospaces 3 --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1369f37..b826dce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,6 @@ void swapPlayerAndMarker(){ } void game(){ - cout<<"Player 1, choose your marker: "; char marker_p1; cin>>marker_p1; current_player=1; @@ -51,23 +50,18 @@ void game(){ drawBoard(); int player_won; for(int i=0;i<9;i++){ - cout<<"It's player "<>slot; if(slot<1||slot>9){ - cout<<"Invalid slot! Try again.\n"; i--; continue; } if(!placeMarker(slot)){ - cout<<"Slot occupied! Try again.\n"; i--; continue; } drawBoard(); player_won=winner(); - if(player_won==1){cout<<"Player 1 wins!\n";break;} - if(player_won==2){cout<<"Player 2 wins!\n";break;} swapPlayerAndMarker(); } if(player_won==0)cout<<"It's a tie!\n"; From c214e02878d135f7cf0a3f27c79e32be1ade5722 Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 14:48:31 -0700 Subject: [PATCH 7/9] change 1 --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b826dce..124d62d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,5 @@ #simple tictactoe code from a friend -include using namespace std; char board[3][3]={{'1','2','3'},{'4','5','6'},{'7','8','9'}}; From 707a3875024b7051c3bbea333f0b5b299d0c78ba Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 15:30:50 -0700 Subject: [PATCH 8/9] Update main.yml --- .github/workflows/main.yml | 94 ++++++++++---------------------------- 1 file changed, 23 insertions(+), 71 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 124d62d..4f29599 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,71 +1,23 @@ -#simple tictactoe code from a friend - -using namespace std; - -char board[3][3]={{'1','2','3'},{'4','5','6'},{'7','8','9'}}; -char current_marker; -int current_player; - -void drawBoard(){ - cout<>marker_p1; - current_player=1; - current_marker=marker_p1; - drawBoard(); - int player_won; - for(int i=0;i<9;i++){ - int slot; - cin>>slot; - if(slot<1||slot>9){ - i--; - continue; - } - if(!placeMarker(slot)){ - i--; - continue; - } - drawBoard(); - player_won=winner(); - swapPlayerAndMarker(); - } - if(player_won==0)cout<<"It's a tie!\n"; -} - -int main(){ - game(); -} \ No newline at end of file +name: Build C++ + +on: + push: + branches: [ main ] + 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@v3 + - name: Build project + run: g++ main.cpp -std=c++17 -o firstIO From 93bc8162373a9f21b3f75797b1d65efe81cbc491 Mon Sep 17 00:00:00 2001 From: LeoMalinen2 Date: Wed, 18 Sep 2024 15:36:43 -0700 Subject: [PATCH 9/9] Update README.md for intro to continuous integration --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a547296..c4e4bd5 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,7 @@ g++ main.cpp and if it compiles successfully, run it with `./a.out` -To exit the container, type `exit` \ No newline at end of file +To exit the container, type `exit` + +Status workflow (x06): +[![Build C++](https://github.com/LeoMalinen2/CppMath/actions/workflows/main.yml/badge.svg)](https://github.com/LeoMalinen2/CppMath/actions/workflows/main.yml)