Skip to content

Commit a5fe988

Browse files
authored
Merge pull request #1 from RezDead/ci/cd
Ci/cd
2 parents dd724bd + 9906dc3 commit a5fe988

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[![Build C++](https://github.com/RezDead/MyFirstExample/actions/workflows/build.yml/badge.svg)](https://github.com/RezDead/MyFirstExample/actions/workflows/build.yml)

main.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using std::cout;
77

88
int 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;

0 commit comments

Comments
 (0)