Write a program that predicts users’ age (0-128 years old) with at most 7 questions. The game starts with asking the user whether he/she is younger or older than G (an initial guess). The user responds with 'O’ for older', ‘Y for 'younger' and ‘X’ for ‘you got it!’
Use a while loop to ask user whether his/her age is ‘>’, ’<’ or ‘=’ the guess. Update the guess using the binary search method. Note that you are not allowed to use “break”. cant figure out where i'm going wrong. tried to change a few things when it wouldn't compile till i got lost in my own code.
Code:
#include <iostream>
#include <cmath>

using namespace std;

int binary_search(int A[], int key, int imin, int imax)
{
    char A = Y || y || O || o || X || x;

    cout << "Are you 128 years old? Type O for older"                                    \

         << " Y for younger or X for 'you got it'" << endl;
    cin >> Y || y || O || o || X || x;

    if (A = Y || y)
}
/*****                                                                                    
int binary_search (int A[], int key, int imin = 0, int imax = 128)                        
{                                                                                         
    while (imin < imax)                                                                   
    {                                                                                     
        int imid = midpoint (i min, i max );                                              
        assert (i mid < imax);                                                            
        if (A[imid] < key)                                                                
            imin = imid + 1;                                                              
        else                                                                              
            imax = imid;                                                                  
    }                                                                                     
    if ((imax == imin) && (A[imin] == key))                                               
        return imin;                                                                      
    else                                                                                  
        return KEY_NOT_FOUND;                                                             
}