CS计算机代考程序代写 #include

#include
#include

/*** Imported Quick Sort ***/

int partition (void* array[], int left, int right, int pivotIndex, int (*cmp) (void*, void*)) {
void *pivotValue, *t;
int storeIndex;

pivotValue = array [pivotIndex];
array [pivotIndex] = array [right];
array [right] = pivotValue;
storeIndex = left;
for (int i=left; ix * a->y;
int productB = b->x * b->y;
return productA < productB? -1: productA == productB? 0: 1; } int main(int argc, char** argv) { // input is pairs of numbers on command line int len = argc / 2; struct pair* list[len]; char** vals = &argv[1]; for (int i=0; ix = atoi (vals[i*2]);
list[i]->y = atoi (vals[i*2+1]);
}

sort((void**) list, len, compare_pairs);

for (int i=0; ix, list[i]->y);
}