#include <iostream>
using namespace std;

int main()
{
  int min(1);
  int max(100);
  
  cout << "Pensez à un nombre entier entre " 
       << min << " et " << max
       << endl;

  bool trouve(false);
  int solution(min -1 );
  
  do {
    const int candidat((max + min) / 2);
    cout << "Votre nb est il < > = à " << candidat << " ? ";

    char reponse('x');
    cin >> reponse;

    switch (reponse) {
    case '<':
      max = candidat - 1 ;
      break;

    case '>':
      min = candidat + 1;
      break;

    case '=':
      trouve = true;
      solution = candidat;
      break;

    default:
      cerr << "pas compris" << endl;
    }

  } while ( not trouve );
  
  cout << "Votre nombre est : " << solution << endl;
  
  return 0;
}
