Website Summary Files Commits Branches @commit @diff @stats
path: root / pract_SI / Pract. 04 / Solutions / task9.cpp
diff options
context:
space:
mode:
Commitca18d5d5c3bb300bc9a353feaffa35275ea7d12e (patch)
Author
 Justsvetoslavov <justsvetoslavov@gmail.com>
2021-11-14 18:28:26 +0200
Committer
 Justsvetoslavov <justsvetoslavov@gmail.com>
2021-11-14 18:28:26 +0200
Files42986320a71b7cc4e5e76b76fdef721a3b5e9ce8 /pract_SI/Pract. 04/Solutions/task9.cpp
Introduction_to_programming_FMI-ca18d5d5c3bb300bc9a353feaffa35275ea7d12e.tar
Introduction_to_programming_FMI-ca18d5d5c3bb300bc9a353feaffa35275ea7d12e.tar.gz
Introduction_to_programming_FMI-ca18d5d5c3bb300bc9a353feaffa35275ea7d12e.zip
Parentc92c14129dbefd34369186019450ead60a8183bb (diff)
Added Solutions Pract.04
1 files changed, 17 insertions, 0 deletions
-rw-r--r--pract_SI/Pract. 04/Solutions/task9.cpp17
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