float temp; int x;
for (int i = 0; i < 4344 ; i++)
for (int j = i + 1; j < 4344; j++)
if (array_dist[i] > array_dist[j])
temp = array_dist[i];
array_dist[i] = array_dist[j];
array_dist[j] = temp;
x = index_arr[i];
index_arr[i] = index_arr[j];
index_arr[j] = x;
cout << "print out distance colum after ascending sorting : \n";
for (int i = 0; i < 4344; ++i)
cout << index_arr[i] << " : "
<< array_dist[i] << endl;
But, I tried to follow the same ordering procedure to store the indices of the original array. But gave me wrong indices. Any suggestion plz.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)