diff --git a/README.md b/README.md new file mode 100644 index 00000000..8710d6d4 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +[![Build C++](https://github.com/Kevinn-Xiong/MyFirstExample/actions/workflows/build.yml/badge.svg)](https://github.com/Kevinn-Xiong/MyFirstExample/actions/workflows/build.yml) diff --git a/main.cpp b/main.cpp index 5411e7a3..3e4107b4 100644 --- a/main.cpp +++ b/main.cpp @@ -16,8 +16,12 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; + if(y == 0) { + cout << "Dividing by zero is not a number." << endl; + } else { cout << "Division: " << x / y << endl; cout << "Remainder: " << x % y << endl; + } cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(x, y) << endl;