diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml new file mode 100644 index 00000000..1f87d8ba --- /dev/null +++ b/.github/workflows/actions.yaml @@ -0,0 +1,24 @@ +name: Build C++ + +on: + push: + branches: "**" + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + install: + runs-on: ubuntu-24.04 + 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-24.04 + steps: + - uses: actions/checkout@v7 + - name: Build project + run: g++ -std=c++17 main.cpp \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..6a221af0 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# My first io repo \ No newline at end of file diff --git a/main.cpp b/main.cpp index a495fc94..6ee62441 100644 --- a/main.cpp +++ b/main.cpp @@ -12,10 +12,14 @@ 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 << "Dividing by zero is not a number." << std::endl; + } 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; - + return 0; }