Website Summary Files Commits Branches @commit @diff @stats
path: root / Week05 / Exercise13.cpp
diff options
context:
space:
mode:
1 files changed, 23 insertions, 0 deletions
-rw-r--r--Week05/Exercise13.cpp23
diff --git a/Week05/Exercise13.cpp b/Week05/Exercise13.cpp
new file mode 100644
index 0000000..cc43afe
--- /dev/null
+++ b/Week05/Exercise13.cpp
@@ -0,0 +1,23 @@
+#include <iostream>
+
+int main() {
+ const unsigned int SIZE = 8;
+
+ int numbers[SIZE];
+ for (unsigned int i = 0; i < SIZE; i++) {
+ std::cin >> numbers[i];
+ }
+
+ int search;
+ std::cin >> search;
+
+ unsigned int occurrences = 0;
+ for (unsigned int i = 0; i < SIZE; i++) {
+ if (numbers[i] == search)
+ occurrences++;
+ }
+
+ std::cout << occurrences << std::endl;
+
+ return 0;
+}