jeudi 18 janvier 2018

if...else in c is ignoring if clause

Heyy!

I am creating a program in c which takes a global var dist01 like this in the initialization of var:

double dist01;  

Then I calculate this value like:

dist01 = sqrt(pow(m2[0][3],2)+pow(m2[1][3],2)+pow(m2[2][3],2));
printf ("Distancia objects[0] y objects[1]= %G\n", dist01);

where m2 and m are matrixes

And I want to use this var in a if...else like this:

if(dist01>=300){


 addObject("data/identic.patt", 120.0, c, drawteapot); 


 addObject("data/simple.patt", 90.0, c, drawteapot);} 



else {addObject("data/identic.patt", 120.0, c, drawcube); 



addObject("data/simple.patt", 90.0, c, drawcube); }

The problem here is that the program is ignoring the if clause and does always what is inside else. Have I done something wrong? Thanks!

Aucun commentaire:

Enregistrer un commentaire