Answer:
#include <iostream>
using namespace std;
int main()
{
string hint;
int min = 1, max = 15, k = 0;
cout << "Please pick a number between 1 and 15."
<< "I will try to guess it in 7 steps. " << endl;
cout << "Is it smaller than 7 ? (yes or no : (y/n)) : ";
while(cin >> hint)
{
if (hint == "n")
{
min = (max+min)/2; max = max;
}
else if (hint == "y")
{
max = (max+min)/2; min = min;
}
k++;
if (k == 4) break;
if (max == min) break;
cout << "Is it smaller than " << (min+max)/2 << " ? " << k << endl;
}
cout << "It is " << min << " :) " << endl;
return 0;
}