Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int a, b;
- cin >> a >> b;
- int middle;
- string ans;
- while (a <= b) {
- middle = ((a + b) / 2);
- cout << middle << endl;
- cout.flush();
- cin >> ans;
- if (ans == "WIN")
- break;
- else if (ans == "LOW")
- a = middle + 1;
- else
- b = middle - 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment