Hi...
I'm having some difficulties to sort two different array (say X and Y), these arrays state the coordinate in x and y axis..so, if X change, Y has to change.
I have unsorted array and I want to eliminate array with the same value...
Here's my code which doesn't work:
I don't know why, but there are some arrays which are not eliminated even though the value are same.
Could you help me please?
Thank you
I'm having some difficulties to sort two different array (say X and Y), these arrays state the coordinate in x and y axis..so, if X change, Y has to change.
I have unsorted array and I want to eliminate array with the same value...
Here's my code which doesn't work:
Code:
#include <stdlib.h> #include <math.h> #include <stdio.h> #include <conio.h> int main () { float X[4][4][24],Y[4][4][24],P[4][4][24],Q[4][4][24],R[4][4][24],S[4][4][24]; int i,j,k,l,m,n,a,b,c,d; X[0][0][0]=-1.414214; Y[0][0][0]=0.000000; X[0][0][1]=-1.414214; Y[0][0][1]=0.000000; X[0][0][2]=-1.000000; Y[0][0][2]=0.414214; X[0][0][3]=-1.414214; Y[0][0][3]=0.000000; X[0][0][4]=-1.000000; Y[0][0][4]=0.000000; X[0][1][0]=-0.707107; Y[0][1][0]=0.707107; X[0][1][1]=0.000000; Y[0][1][1]=0.000000; X[0][1][2]=-1.000000; Y[0][1][2]=0.414214; X[0][1][3]=0.000000; Y[0][1][3]=0.000000; X[0][1][4]=0.000000; Y[0][1][4]=0.000000; X[0][1][5]=0.000000; Y[0][1][5]=0.000000; X[0][1][6]=0.000000; Y[0][1][6]=0.000000; X[0][1][7]=-1.000000; Y[0][1][7]=0.000000; X[0][1][8]=0.000000; Y[0][1][8]=0.000000; X[0][2][0]=-1.414214; Y[0][2][0]=0.000000; X[0][2][1]=-1.414214; Y[0][2][1]=0.000000; X[0][2][2]=-1.000000; Y[0][2][2]=-0.414214; X[0][2][3]=-1.000000; Y[0][2][3]=0.000000; X[0][3][0]=-0.707107; Y[0][3][0]=-0.707107; X[0][3][1]=0.000000; Y[0][3][1]=0.000000; X[0][3][2]=-1.000000; Y[0][3][2]=-0.414214; X[0][3][3]=0.000000; Y[0][3][3]=0.000000; X[0][3][4]=0.000000; Y[0][3][4]=0.000000; X[0][3][5]=0.000000; Y[0][3][5]=0.000000; X[0][3][6]=0.000000; Y[0][3][6]=0.000000; X[0][3][7]=-1.000000; Y[0][3][7]=0.000000; X[0][3][8]=0.000000; Y[0][3][8]=0.000000; X[1][0][0]=-0.414214; Y[1][0][0]=1.000000; X[1][0][1]=0.000000; Y[1][0][1]=1.414214; X[1][0][2]=0.000000; Y[1][0][2]=1.414214; X[1][0][3]=0.000000; Y[1][0][3]=1.000000; X[1][1][0]=0.000000; Y[1][1][0]=1.414214; X[1][1][1]=0.000000; Y[1][1][1]=1.414214; X[1][1][2]=0.414214; Y[1][1][2]=1.000000; X[1][1][3]=0.000000; Y[1][1][3]=1.414214; X[1][1][4]=0.000000; Y[1][1][4]=1.000000; X[1][1][5]=-0.707107; Y[1][1][5]=0.707107; X[1][2][0]=-0.707107; Y[1][2][0]=0.707107; X[1][2][1]=0.000000; Y[1][2][1]=0.000000; X[1][2][2]=-0.414214; Y[1][2][2]=1.000000; X[1][2][3]=0.000000; Y[1][2][3]=0.000000; X[1][2][4]=0.000000; Y[1][2][4]=0.000000; X[1][2][5]=0.000000; Y[1][2][5]=0.000000; X[1][2][6]=0.000000; Y[1][2][6]=0.000000; X[1][2][7]=0.000000; Y[1][2][7]=1.000000; X[1][2][8]=0.000000; Y[1][2][8]=0.000000; X[1][3][0]=0.000000; Y[1][3][0]=0.000000; X[1][3][1]=0.707107; Y[1][3][1]=0.707107; X[1][3][2]=0.000000; Y[1][3][2]=0.000000; X[1][3][3]=0.000000; Y[1][3][3]=0.000000; X[1][3][4]=0.414214; Y[1][3][4]=1.000000; X[1][3][5]=0.000000; Y[1][3][5]=0.000000; X[1][3][6]=0.000000; Y[1][3][6]=0.000000; X[1][3][7]=0.000000; Y[1][3][7]=1.000000; X[1][3][8]=0.000000; Y[1][3][8]=0.000000; X[1][3][9]=0.000000; Y[1][3][9]=0.000000; X[1][3][10]=0.000000; Y[1][3][10]=0.000000; X[1][3][11]=0.000000; Y[1][3][11]=0.000000; X[1][3][12]=0.000000; Y[1][3][12]=0.000000; X[1][3][13]=0.000000; Y[1][3][13]=0.000000; X[1][3][14]=0.000000; Y[1][3][14]=0.000000; X[1][3][15]=0.000000; Y[1][3][15]=0.000000; X[1][3][16]=-0.707107; Y[1][3][16]=-0.707107; for (d=0;d<2;d++) { for (l=0;l<2;l++){ k=0; for (i=0;i<17;i++){ if (X[d][l][i] != X[d][l][i+1] && Y[d][l][i] !=Y[d][l][i+1]){ for (j=k;j<=k;j++){ R[d][l][j]=X[d][l][i]; S[d][l][j]=Y[d][l][i]; printf ("[%d][%d][%d]\t%f\t%f\n",d,l,j,R[d][l][j],S[d][l][j]); if (R[d][l][j]>R[d][l][j+1] && S[d][l][j+1]){ for (c=m;c<=m;c++){ P[d][l][c]=R[d][l][j]; Q[d][l][c]=S[d][l][j]; printf ("[%d][%d][%d]\t%f\t%f\n",d,l,c,P[d][l][c],Q[d][l][c]); }m++; } }k++; } } } } getch (); }
I don't know why, but there are some arrays which are not eliminated even though the value are same.
Could you help me please?
Thank you