aboutsummaryrefslogtreecommitdiff
path: root/operating-system-experiment/DeadLockDetectionDemo.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-12 23:20:15 +0800
committercrupest <crupest@outlook.com>2021-06-12 23:25:49 +0800
commit7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531 (patch)
treef698e7730919bd6c7a0ea441ed66de971d11db97 /operating-system-experiment/DeadLockDetectionDemo.cpp
parent0c1d400a5f3a93a245e579bbfa7aa251077eff26 (diff)
downloadlife-7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531.tar.gz
life-7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531.tar.bz2
life-7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531.zip
...
Diffstat (limited to 'operating-system-experiment/DeadLockDetectionDemo.cpp')
-rw-r--r--operating-system-experiment/DeadLockDetectionDemo.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/operating-system-experiment/DeadLockDetectionDemo.cpp b/operating-system-experiment/DeadLockDetectionDemo.cpp
new file mode 100644
index 0000000..b22549e
--- /dev/null
+++ b/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;
+ }
+
+
+}