From 5c2a824ade11ac8ed5149baf116bf6b713bd345a Mon Sep 17 00:00:00 2001 From: Lucas C Date: Tue, 3 Feb 2026 23:36:16 -0800 Subject: [PATCH 1/4] Fixed NaN_errors --- main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.cpp b/main.cpp index a495fc94..a55c239d 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,8 @@ 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; std::cout << "Square Root: " << sqrt(x) << std::endl; From c0ea7b70d4f6f12e3aee487c31f771bb4fb84431 Mon Sep 17 00:00:00 2001 From: Lucas C Date: Tue, 3 Feb 2026 23:38:27 -0800 Subject: [PATCH 2/4] Fixed Nan Errors --- main.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index a55c239d..9320cb63 100644 --- a/main.cpp +++ b/main.cpp @@ -6,18 +6,28 @@ int main() std::cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; std::cout << "Hi, please enter two whole numbers: "; - int x,y; + int x, y; std::cin >> x >> y; 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; - std::cout << "Square Root: " << sqrt(x) << std::endl; - std::cout << "Square: " << pow(x, y) << std::endl; + if (y != 0) { + std::cout << "Division: " << x / y << std::endl; + std::cout << "Remainder: " << x % y << std::endl; + } else { + std::cout << "Division: undefined (division by zero)" << std::endl; + std::cout << "Remainder: undefined (division by zero)" << std::endl; + } + + if (x >= 0) { + std::cout << "Square Root: " << sqrt(x) << std::endl; + } else { + std::cout << "Square Root: undefined (negative number)" << std::endl; + } + + std::cout << "Power: " << pow(x, y) << std::endl; return 0; } From 37cf316c13163ca621b50ebee1a7ecc15cf053e2 Mon Sep 17 00:00:00 2001 From: Lucas C Date: Wed, 11 Feb 2026 11:45:29 -0800 Subject: [PATCH 3/4] added workflows --- .github/workflows/actions.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/actions.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 00000000..b5bf693b --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,23 @@ +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: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build project + run: g++ -std=c++17 main.cpp From 59e41b20c5668fe2c9d4b3579dab756342705eb4 Mon Sep 17 00:00:00 2001 From: Lucas C Date: Wed, 11 Feb 2026 12:05:32 -0800 Subject: [PATCH 4/4] new --- .github/workflows/actions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index b5bf693b..a286f4b5 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -21,3 +21,5 @@ jobs: - uses: actions/checkout@v4 - name: Build project run: g++ -std=c++17 main.cpp + +