bubble sort with an array
i need to sort the array of int id[10]. this is how is see it in the book but it does do anything. it compiles with no problem but doesnt change any order. any help i would greatly apreciate it. thank you. :cool:
Code:
void CD::bubblesort(int id[10],int last)
{
for(int current=0;current<last;current++)
bubbleup(id,current,last);
return;
}
void CD::bubbleup(int id[10],int current, int last)
{
for(int walker=last;walker>current;walker--)
if(id[walker]<id[walker-1])
{
int temp=id[walker];
id[walker]=id[walker-1];
id[walker-1]=temp;
}
return;
}