summaryrefslogtreecommitdiffstats
path: root/lab1/lib/lifeutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lab1/lib/lifeutil.cpp')
-rw-r--r--lab1/lib/lifeutil.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lab1/lib/lifeutil.cpp b/lab1/lib/lifeutil.cpp
new file mode 100644
index 0000000..204ed6d
--- /dev/null
+++ b/lab1/lib/lifeutil.cpp
@@ -0,0 +1,23 @@
+#include <cstdlib>
+#include <chrono>
+#include <thread>
+#include "lifeutil.h"
+
+void clearConsole()
+{
+#if defined(_WIN32) || defined (_WIN64)
+ std::system("CLS");
+#else
+ // assume POSIX
+ std::system("clear");
+#endif
+}
+
+
+void pause(int ms)
+{
+ if (ms > 0)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(ms));
+ }
+}