Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "cust_std_lib_facilities.h"
- #include <iostream>
- #include <chrono>
- #include <stdexcept>
- #include <random>
- #include <string>
- int randint(int min, int max)
- {
- using namespace std;
- auto seed = chrono::system_clock::now().time_since_epoch().count();
- static default_random_engine ran(seed);
- return uniform_int_distribution<>{min, max}(ran);
- }
- void keep_window_open()
- {
- using namespace std;
- cin.clear();
- cout << "Please enter a character to exit\n";
- char ch;
- cin >> ch;
- return;
- }
- void keep_window_open(std::string s)
- {
- using namespace std;
- if (s == "") return;
- cin.clear();
- cin.ignore(120, '\n');
- for (;;) {
- cout << "Please enter " << s << " to exit\n";
- string ss;
- while (cin >> ss && ss != s)
- cout << "Please enter " << s << " to exit\n";
- return;
- }
- }
- void error(const std::string& s)
- {
- using namespace std;
- throw runtime_error(s);
- }
- void error(const std::string& s, const std::string& s2)
- {
- error(s + s2);
- }
Add Comment
Please, Sign In to add comment