Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Stupid procedure problem
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
A.J




PostPosted: 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)
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: