Now I am doing tideman and I already test and all are working well and get the expected result.but when I check with Check50,I got this msg
:( tideman compiles code failed to compile
I just added one recursive function and If I add this function its says like that, but if I remove this recursive, It works fine and says I have an error.below are locked function and the custom function called isCircle
.
bool isCircle(int winner,int loser,int main)
{
for(int i=0;i<pair_count;i++)
{
if(pairs[i].winner == winner && pairs[i].loser == loser){
continue;
}
if(pairs[i].loser==winner)
{
**if(pairs[i].winner == main){
return true;
}else
{
return isCircle(pairs[i].winner,pairs[i].loser,main);
}**
}
}
return false;
}
void lock_pairs(void)
{
// TODO
for(int i=0;i<pair_count;i++)
{
if(i<2)
{
locked[pairs[i].winner][pairs[i].loser]=true;
continue;
}
bool circle=isCircle(pairs[i].winner,pairs[i].loser,pairs[i].loser);
if(circle){
locked[pairs[i].winner][pairs[i].loser]=false;
continue;
}
locked[pairs[i].winner][pairs[i].loser]=true;
}
return;
}
I added this iscircle
function and if I remove this following lines from isCircle function it working.
if(pairs[i].winner == main){
return true;
}else
{
return isCircle(pairs[i].winner,pairs[i].loser,main);
}
What happening? What is wrong in this isCircle
?