|
|
back to boardIt will make test for you Posted by D4nick 5 Jun 2022 23:20 int make_test() { fstream inp("input2.txt", ios::out | ios::binary | ios::in | ios::trunc); if (!inp) { _Post_equals_last_error_ DWORD er = GetLastError(); cerr << er << '\n'; _getch(); exit(1); } int n = 100; inp << n << '\n'; srand(time(0)); for (int i = 0; i < n; i++) { int sign = rand() % 2; if (sign == 1 || i < 2) { int a = rand() % 300; while (find(simple.begin(), simple.end(), a) != simple.end()) { a = rand() % 300; } inp << "+ " << a << '\n'; v.push_back(a); } else if (v.size() > 1) { int a = rand() % v.size(); inp << "- " << v[a] << '\n'; v.erase(v.begin() + a); } } inp.close(); return 0; } |
|
|