File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Build C++
2+
3+ on :
4+ push :
5+ branches : [ main , ci/cd ]
6+
7+ jobs :
8+ install :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Install dependencies
12+ run : |
13+ sudo apt-get update
14+ sudo apt-get install -y -f build-essential g++ cmake
15+
16+ build :
17+ needs : install
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Build project
22+ run : g++ -std=c++17 main.cpp
Original file line number Diff line number Diff line change 1+ [ ![ Build C++] ( https://github.com/RezDead/MyFirstExample/actions/workflows/build.yml/badge.svg )] ( https://github.com/RezDead/MyFirstExample/actions/workflows/build.yml )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ using std::cout;
77
88int main ()
99{
10- cout << " THE FIRST EXAMPLE MATH DISPLAY!\n " ;
10+ cout << " THE FIRST EXAMPLE MATH DISPLAY!\n "
1111 cout << " Hi, please enter two whole numbers: " ;
1212
1313 int x,y;
@@ -16,7 +16,10 @@ int main()
1616 cout << " Addition: " << x + y << endl;
1717 cout << " Subtraction: " << x - y << endl;
1818 cout << " Multiplication: " << x * y << endl;
19- cout << " Division: " << x / y << endl;
19+ if (y == 0 )
20+ cout << " Dividing by zero is not a number" << endl;
21+ else
22+ cout << " Division: " << x / y << endl;
2023 cout << " Remainder: " << x % y << endl;
2124 cout << " Square Root: " << sqrt (x) << endl;
2225 cout << " Square: " << pow (x, y) << endl;
You can’t perform that action at this time.
0 commit comments