So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer....
So here's the part of my code I have problem with:
Expand|Select|Wrap|Line Numbers
- for (i=0; i<size2; i++){
- for (k = 0; k < point3[i]; k++){
- for (a=0;a<b[i][k];a++){
- if (90<sudut [i][k][a]<=180){
- teta[i][k][a]=180-sudut[i][k][a];
- }
- else{
- if (180<=sudut [i][k][a]<270){
- teta[i][k][a]=sudut[i][k][a]-180;
- }
- else {
- if (270<=sudut [i][k][a]<360){
- teta[i][k][a]=360-sudut[i][k][a];
- }
- else {
- if (0<=sudut[i][k][a]<90){
- teta[i][k][a]=sudut[i][k][a];
- }
- }
- }
- }
- printf ("[%d][%d][%d]=%f\t%f\n",i,k,a,sudut[i][k][a],teta[i][k][a]);
- }
- }
- }
sudut [0][0][0] = 53.157051
teta [0][0][0] = 126.842949
sudut [0][0][1] = 206.000000
teta[0][0][1] = -26.000000
sudut[0][0][4] =341.555695
teta[0][0][4] = -161.555695
sudut [0][1][0] =127.272743
teta [0][1][0] = 52.727257
All of the result is wrong, I just show some because it is so many. I'm sorry...
P.S: if I change the order of the conditions, only the first condition will be result the right answers.
Could you tell me, where I did wrong?
Thank you for your help....