#include <iostream>

int main()
{
	int L = 0;
	int R = 101;
	char spell = true;
	std::cout << "Is the number you thought of larger than (please, input 'y', 'n' or '=') " << 50 << "? ";
	while (std::cin >> spell)
	{
		if (spell != 'y' && spell != 'n' && spell != '=')
		{
			std::cout << "Please, input 'y', 'n' or '=': " << std::endl;
			continue;
		}

		int M = (L + R) / 2;

		if (spell == '=')
		{
			std::cout << "The number you thought of is " << M << "!" << std::endl;
			break;
		}

		switch (spell)
		{
			case 'y':
			{
				L = M;
				break;
			}
			case 'n':
			{
				R = M;
				break;
			}
		}

		M = (L + R) / 2;

		std::cout << "Is the number you thought of larger than " << M << "? ";
	}
}