You are viewing a single comment's thread. Return to all comments →
hello, my code give me run time error each time can you help me?
void sort_by_area(triangle* tr, int n) { int S[n-1]; for(int i = 0 ; i < n ; i++) { int p = (tr[i].a + tr[i].b + tr[i].c)/2; S[i]=sqrt(p * ( p - tr[i].a ) * ( p - tr[i].b ) * ( p - tr[i].c ) ); } for(int i = 0 ; i < n ; i++ ) { for (int j = 0 ; j < n ; j++ ) { int tempS; triangle* temptr = tr; if ( S[j] > S[j+1] ) { tempS = S[j]; *temptr = tr[j]; S[j]=S[j+1]; tr[j]=tr[j+1]; S[j+1] = tempS; tr[j+1] = *temptr; } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Small Triangles, Large Triangles
You are viewing a single comment's thread. Return to all comments →
hello, my code give me run time error each time can you help me?