From 331b436c01952bd6d28ce9229b558c71fd08025d Mon Sep 17 00:00:00 2001 From: linuchs Date: Sat, 21 Oct 2023 23:42:41 +0200 Subject: [PATCH 1/3] feat: This is my calculator --- exercises/calculator.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/exercises/calculator.cpp b/exercises/calculator.cpp index 013cc78..37c42d8 100644 --- a/exercises/calculator.cpp +++ b/exercises/calculator.cpp @@ -10,3 +10,19 @@ Multiplication: 8 Division: 2 */ +#include + +using namespace std; +int main() { + int first; + int second; + cout << "Insert the first number: "; + cin >> first; + cout << "Insert the second number: "; + cin >> second; + cout << "SUM: " << first + second << "\n"; + cout << "Difference: " << first - second << "\n"; + cout << "Multiplication: " << first * second << "\n"; + cout << "Division: " << first / second; + return 0; +} \ No newline at end of file From 8c5ce0105e38aad78ab36a15e10995635fef58e4 Mon Sep 17 00:00:00 2001 From: linuchs Date: Sun, 22 Oct 2023 09:28:26 +0200 Subject: [PATCH 2/3] feat: Implementing a calculator --- exercises/calculator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/calculator.cpp b/exercises/calculator.cpp index 37c42d8..6333846 100644 --- a/exercises/calculator.cpp +++ b/exercises/calculator.cpp @@ -11,16 +11,16 @@ Division: 2 */ #include - -using namespace std; int main() { + using std::cout; + using std::cin; int first; int second; - cout << "Insert the first number: "; + cout << "Insert first number: "; cin >> first; - cout << "Insert the second number: "; + cout << "Insert second number: "; cin >> second; - cout << "SUM: " << first + second << "\n"; + cout << "Sum: " << first + second << "\n"; cout << "Difference: " << first - second << "\n"; cout << "Multiplication: " << first * second << "\n"; cout << "Division: " << first / second; From ebb9c4cac410cb2f7bbfc227c33a9f33504bafe9 Mon Sep 17 00:00:00 2001 From: linuchs Date: Mon, 23 Oct 2023 08:35:16 +0200 Subject: [PATCH 3/3] feat: Modified - This is my calculator --- exercises/calculator.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/exercises/calculator.cpp b/exercises/calculator.cpp index 6333846..2923881 100644 --- a/exercises/calculator.cpp +++ b/exercises/calculator.cpp @@ -11,18 +11,26 @@ Division: 2 */ #include -int main() { - using std::cout; - using std::cin; + +using namespace std; + +void FourOps(int x, int y) +{ + cout << "Sum: " << x + y << "\n"; + cout << "Difference: " << x - y << "\n"; + cout << "Multiplication: " << x * y << "\n"; + cout << "Division: " << x / y; + return; + } + +int main() +{ int first; int second; cout << "Insert first number: "; cin >> first; cout << "Insert second number: "; cin >> second; - cout << "Sum: " << first + second << "\n"; - cout << "Difference: " << first - second << "\n"; - cout << "Multiplication: " << first * second << "\n"; - cout << "Division: " << first / second; + FourOps(first, second); return 0; } \ No newline at end of file