From 8fde6862b561daf406a35813eab91e9279790f6f Mon Sep 17 00:00:00 2001 From: CharcoalNuggets Date: Wed, 11 Sep 2024 12:01:12 -0700 Subject: [PATCH 1/2] Added division operation --- main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 47b917d..946ee0f 100644 --- a/main.cpp +++ b/main.cpp @@ -18,6 +18,8 @@ int main(){ cout<< (first-second) << endl; cout<< "Multiplication: "<< first << "*" << second << "="; cout<< (first*second) << endl; + cout<< "Divisioon: "<< first << "/" << second << "="; + cout<< (first/second) << endl; return 0; -} \ No newline at end of file +} From 9861544e6b28e39924ac0372867ba5a3d1ed8985 Mon Sep 17 00:00:00 2001 From: CharcoalNuggets Date: Wed, 11 Sep 2024 12:33:16 -0700 Subject: [PATCH 2/2] Added division operation --- main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 946ee0f..4a25425 100644 --- a/main.cpp +++ b/main.cpp @@ -19,7 +19,12 @@ int main(){ cout<< "Multiplication: "<< first << "*" << second << "="; cout<< (first*second) << endl; cout<< "Divisioon: "<< first << "/" << second << "="; - cout<< (first/second) << endl; + if(second == 0){ + cout<< "Error - cannot divide by zero!" << endl; + } + else{ + cout<< (first/second) << endl; + } return 0; }