Computer Science Canada

Stupid procedure problem

Author:  A.J [ Fri Apr 25, 2008 9:02 pm ]
Post subject:  Stupid procedure problem

I don't remember whta's wrong with calling a procedure in itself?

here's the code:
C:

void guess(int lower,int upper)
{
    int guess=(lower+upper)/2;
    char hl;
    cout<<guess<<endl;
    cin>>hl;
    if (hl=='L')
    {
        guess(guess+1,upper);
    }
    else if(hl=='H')
    {
        guess(lower,guess-1);
    }
}

please help Puppy Dog Eyes

EDIT: NVM I got it (I used same variable names for the procedure and a variable)


: