diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 00000000..e21693b8 --- /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 \ No newline at end of file diff --git a/gradeyourmelody.md b/gradeyourmelody.md new file mode 100644 index 00000000..bdf81703 --- /dev/null +++ b/gradeyourmelody.md @@ -0,0 +1,5 @@ +GRADEYOURMELODY + +##Devs + +-Aaron Robinson Almazan [aaronrobinsona] (https://github.com/aaronrobinsona) \ No newline at end of file diff --git a/main.cpp b/main.cpp index a495fc94..652ca31c 100644 --- a/main.cpp +++ b/main.cpp @@ -1,21 +1,31 @@ #include #include +using std::endl; +using std::cin; +using std::cout; + int main() { - std::cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; - std::cout << "Hi, please enter two whole numbers: "; + cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; + cout << "Hi, please enter two whole numbers: "; 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; + cin >> x >> y; + 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.\n"; + } + else{ + cout << "Division: " << x / y << std::endl; + } + cout << "Remainder: " << x % y << endl; + cout << "Square Root: " << sqrt(x) << endl; + cout << "Square: " << pow(x, y) << endl; + return 0; }