bubble sort descending
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
int sortingWeekly(int sales[7][noweeks], int week)
{
int temp;
int i;
int k;
for (i=0; i<6; i++);
{
for (k=i+1; k<6; k++)
{
if (sales[i][week] < sales[k][week])
{
temp = sales[i][week];
sales[i][week] = sales[k][week];
sales[k][week] = temp;
}
}
}
return temp;
}
|
It's my function and when I call it in the main, it should do this every week, but I am not getting proper results just one long number! help please!
I want to use bubble sorting so that all the elements in every column will be in descending order.
Last edited on
Can you elaborate a bit more on what you are trying to do here? (i.e. what you were expecting, what you are getting, the purpose of the code)
I want to use buble sorting so that all the elements in each column will be in descending order.
Topic archived. No new replies allowed.