aboutsummaryrefslogtreecommitdiff
path: root/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'works/life/operating-system-experiment/DeadLockDetectionDemo.cpp')
-rw-r--r--works/life/operating-system-experiment/DeadLockDetectionDemo.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp b/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp
new file mode 100644
index 0000000..b22549e
--- /dev/null
+++ b/works/life/operating-system-experiment/DeadLockDetectionDemo.cpp
@@ -0,0 +1,25 @@
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+int main() {
+ std::vector<int> ns;
+
+ while (!std::cin.eof() || std::cin) {
+ int n;
+ std::cin >> n;
+ ns.push_back(n);
+ }
+
+ if (!std::cin.eof()) {
+ std::cerr << "Failed to parse input.\n";
+ return -1;
+ }
+
+ if (ns.size() % 2 != 0) {
+ std::cerr << "Input integer number must be even.\n";
+ return -1;
+ }
+
+
+}