From 9d0d6d7dfdf3ef478ea0e21d9f6fdfde9a22d520 Mon Sep 17 00:00:00 2001 From: tojusts Date: Mon, 2 Feb 2026 11:18:44 -0800 Subject: [PATCH 1/8] Fixes divide by zero error, resolves #61 --- main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index a495fc94..84c36bd9 100644 --- a/main.cpp +++ b/main.cpp @@ -12,8 +12,12 @@ int main() std::cout << "Addition: " << x + y << std::endl; std::cout << "Subtraction: " << x - y << std::endl; std::cout << "Multiplication: " << x * y << std::endl; - std::cout << "Division: " << x / y << std::endl; - std::cout << "Remainder: " << x % y << std::endl; + if (y == 0) { + std::cout << "Divide by zero is not a number\n"; + } else { + std::cout << "Division: " << x / y << std::endl; + std::cout << "Remainder: " << x % y << std::endl; + } std::cout << "Square Root: " << sqrt(x) << std::endl; std::cout << "Square: " << pow(x, y) << std::endl; From e250f889ac99d676e6b2f6bea3ee210be9411032 Mon Sep 17 00:00:00 2001 From: tojusts Date: Wed, 11 Feb 2026 12:05:49 -0800 Subject: [PATCH 2/8] Adding a .yml file --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..30d74d25 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1 @@ +test \ No newline at end of file From 2fcfe6c610a540c34c8caecca27006c137f7d209 Mon Sep 17 00:00:00 2001 From: tojusts Date: Wed, 11 Feb 2026 12:35:37 -0800 Subject: [PATCH 3/8] Made changes to the yml file --- .github/workflows/test.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30d74d25..a934977e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1 +1,23 @@ -test \ No newline at end of file +name: Build C++ + +on: + push: + branches: "**" + 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: ubunutu-latest + steps: + - uses: actions/checkout@v4 + - name: Build projects + run: g++ -std+c++17 main.cpp \ No newline at end of file From 2a9c295c1055fe4a558b5cd8d50bfe6f57d7d65d Mon Sep 17 00:00:00 2001 From: tojustis <157431633+tojustis@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:37:29 -0800 Subject: [PATCH 4/8] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..54b6da1c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +[![Build C++](https://github.com/tojustis/MyFirstExample/actions/workflows/test.yml/badge.svg)](https://github.com/tojustis/MyFirstExample/actions/workflows/test.yml) From 8c7e3197e205311c397e1fadd153f73491e38c4d Mon Sep 17 00:00:00 2001 From: tojusts Date: Wed, 11 Feb 2026 14:41:39 -0800 Subject: [PATCH 5/8] Added a comment for divide by zero condition --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index c54b3153..69b4295b 100644 --- a/main.cpp +++ b/main.cpp @@ -16,6 +16,7 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; + // This prevents a divide by zero error if (y == 0) { cout << "Divide by zero is not a number\n"; } else { From 6119eed3007e92c8e4b182227f8c223113c5099d Mon Sep 17 00:00:00 2001 From: tojusts Date: Wed, 11 Feb 2026 14:46:53 -0800 Subject: [PATCH 6/8] fixed spelling of ubuntu in run-ons --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a934977e..77baf748 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: sudo apt-get install -y -f build-essential g++ cmake build: needs: install - runs-on: ubunutu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build projects From d5330fa340ee29cc8ce79d630228219c0fdc615f Mon Sep 17 00:00:00 2001 From: tojusts Date: Wed, 11 Feb 2026 15:02:54 -0800 Subject: [PATCH 7/8] Added comment for CI/CO practice --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index 69b4295b..f57141e9 100644 --- a/main.cpp +++ b/main.cpp @@ -17,6 +17,7 @@ int main() cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; // This prevents a divide by zero error + // Made change for github actions if (y == 0) { cout << "Divide by zero is not a number\n"; } else { From 2b70573041f8150434ccea436e5ecd919249b4d5 Mon Sep 17 00:00:00 2001 From: tojusts Date: Wed, 11 Feb 2026 15:06:34 -0800 Subject: [PATCH 8/8] Fixed typo in step/run: --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77baf748..fa84d3ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,4 +20,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build projects - run: g++ -std+c++17 main.cpp \ No newline at end of file + run: g++ -std=c++17 main.cpp \ No newline at end of file