yesterday I spent the whole day on a problem I simply won't be able to figure out. I got an IF statement inside a while loop and the IF statement contains a function call. The function only changes coordinate values but to make sure that I didn't type something wrong in it I changed it to a simple cout statement. But the function is completely ignored for some reason. Here's what I got:
to see if there was any change in the value but it stays the same.
(again, I altered the funtion above to ... {cout << "here";} but nothing happens (no ''here'' appears in the dosbox). What am I doing wrong or should it be impossible to call a function in that if statement?
yep, it's quite long though and actually it's two while loops nested inside a for loop but I thought that this may be irrelevant as everything else works just fine. Ok, here it is:
while (true){if (qq==qqmax){break;}
if (check==1){break;}
if (gfound==1){break;}
pixeloldx=pixelx;pixeloldy=pixely;
if (check==0){calculation();comparison();}
if (check==1){break;}
if (gfound==1){break;}
pixelx=pixelx+1;
if (check==0){calculation();comparison();if (gfound==1){break;}}
if (check==1){break;}
pixely=pixely+1;
while (true){
qq=qq+2;cout <<qq;cout <<" ";cout<<gfound;cout<<"\n";
if (qq==qqmax){npixelcor[runner2]=-10000;npixelcor[runner2+1]=-10000;runner2=runner2+2;addblocksize2;cout<<"pixelx";cout<<pixelx;cout<<"\n";break;}
for (kkk=0;kkk<qq;kkk++)
{pixelx=pixelx-1;
calculation();comparison();if (gfound==1){break;}}
... then comes a lot of other for loops (like the one above this line) and then the while loops are closed. Maybe it's the qq==qqmax condition in the 1st while loop?
If the code is too big, try posting the code on Pastebin[1]. From there, I will be able to read you code fully. Also, make sure that you select the correct language. When you've posted the code, post the link here.
edit: I have circumvented the function by simply writing it's content into the IF condition. Now it works and for me that suffices. I guess it's because of the first while loop which also contains the condition qq==qqmax. Probably it won't 'jump' to the function anymore if the condition is met. Anyway, thanks for your help!