#include<iostream> #include<vector> #include<algorithm> using namespace std; void main() { vector<unsigned> scores(0); for (decltype(scores.size()) ix = 0; ix < scores.size(); ++ix) { scores.push_back(ix); } sort(scores.begin(), scores.end()); auto beg = scores.begin(), end = scores.end(); auto mid = scores.begin() + scores.size() / 2; int a = 4; while (mid != end && *mid != a) { if (a < *mid) end = mid; else beg = mid + 1; mid = beg + (end - beg) / 2; } system("pause"); }