Website Summary Files Commits Branches @commit @diff @stats
path: root / Week05 / Exercise08.cpp
diff options
context:
space:
mode:
Commit9242ebc4c69f2c1f550ddcc0e9235f3f409554c7 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-11-01 20:27:21 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-11-01 20:27:21 +0200
Files8a49b14236dca88758fa72781ef15144e9cbc214 /Week05/Exercise08.cpp
upp-2025-solutions-9242ebc4c69f2c1f550ddcc0e9235f3f409554c7.tar
upp-2025-solutions-9242ebc4c69f2c1f550ddcc0e9235f3f409554c7.tar.gz
upp-2025-solutions-9242ebc4c69f2c1f550ddcc0e9235f3f409554c7.zip
Parent69de8ecfb2df52a6a4ae9d75f6a018ae380cca05 (diff)
feat(Week05): Add exercises and solutions
1 files changed, 32 insertions, 0 deletions
-rw-r--r--Week05/Exercise08.cpp32
diff --git a/Week05/Exercise08.cpp b/Week05/Exercise08.cpp
new file mode 100644
index 0000000..47fa376
--- /dev/null
+++ b/Week05/Exercise08.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+
+int main() {
+ const unsigned int SIZE = 10;
+
+ /* Става по-елегантно ако използваме един масив */
+ double row1[SIZE], row2[SIZE];
+ for (int i = 0; i < SIZE; i++) {
+ std::cin >> row1[i];
+ }
+ for (int i = 0; i < SIZE; i++) {
+ std::cin >> row2[i];
+ }
+
+ char operation;
+ std::cin >> operation;
+
+ double result;
+ for (int i = 0; i < SIZE; i++) {
+ switch (operation) {
+ case '+': result = row1[i] + row2[i]; break;
+ case '-': result = row1[i] - row2[i]; break;
+ case '*': result = row1[i] * row2[i]; break;
+ case '/': result = row1[i] / row2[i]; break;
+ }
+ std::cout << result << ' ';
+ }
+
+ std::cout << std::endl;
+
+ return 0;
+}