From ca18d5d5c3bb300bc9a353feaffa35275ea7d12e Mon Sep 17 00:00:00 2001 From: Justsvetoslavov Date: Sun, 14 Nov 2021 18:28:26 +0200 Subject: Added Solutions Pract.04 --- pract_SI/Pract. 04/Solutions/task9.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pract_SI/Pract. 04/Solutions/task9.cpp (limited to 'pract_SI/Pract. 04/Solutions/task9.cpp') diff --git a/pract_SI/Pract. 04/Solutions/task9.cpp b/pract_SI/Pract. 04/Solutions/task9.cpp new file mode 100644 index 0000000..0356de8 --- /dev/null +++ b/pract_SI/Pract. 04/Solutions/task9.cpp @@ -0,0 +1,17 @@ +int calculate(int a, int b, char action = '+') +{ + switch (action) + { + case '+': return a + b; + + case '-': return a - b; + + case '*': return a * b; + + case '/': return a / b; + + case '%': return a % b; + + default: return -1; + } +} \ No newline at end of file -- cgit v1.3.1-23-gd82d