how could I fix this?? it always goes first tank,shouldn't it be random? or is there any way to code this with strings? there is 10 tank and we put insert some coins in. goes from this pattern
for(k=0;k<=Jsayi-1;k++){
printf("%d . press smth to continue ",k+1);
//1 ise sola 0 ise sağa düşer
left=0;
for(i=0;i<9;i++)
{
while(rand()%2!=0)
left++;
}
I believe problem is here
if(left=9){
hzn1++;
printf("1. tank \n");
}else if(left=8)
{hzn2++;
printf("2. tank \n");
} else if(left=7)
{hzn3++;
printf("3. tank \n");
}else if(left=6)
{hzn4++;
printf("4. tank. \n");
}else if(left=5)
{hzn5++;
printf("5. tank \n");
}else if(left=4)
{hzn6++;
printf("6. tank \n");
}else if(left=3)
{hzn7++;
printf("7. tank\n");
}else if(left=2)
{hzn8++;
printf("8. tank \n");
} else if(left=1)
{hzn9++;
printf("9. tank \n");}
else if(left=0)
{hzn10++;
printf("10. tank \n");
} } }
where do you guys I am wrong I couldn't find the solution or another algorithm
Aucun commentaire:
Enregistrer un commentaire