Catatan Kuliahku... (C++ selection sort function)

# include
#include
void selectionSort(int*array,int length)
{
int i,j,min,minat;
for(i=0;i<(length-1);i++)
{
minat=1;
min=array[i];
for(j=i+1;j<(length);j++)
{
if(min>array[j])
{
minat=j;
min=array[j];
}
}
int temp=array[i];
array[i]=array[minat];
array[minat]=temp;
}
}

void printElements(int*array,int length)
{
int i=0;
for(i=0;i<10;i++)
cout<<
}

void main()
{
int a[]={9,6,5,23,2,6,7,1,8};
selectionSort(a,10);
printElements(a,10);
getch();
}

Tidak ada komentar:

Posting Komentar