#include
#include
int select_sort(int array[], int size)
{
int temp, current, i;
for (current = 0; current < size; current++)
for (i = current + 1; i < size; i ++)
{
if (array[current] > array[i])
{
temp = array[current];
array[current] = array[i];
array[i] = temp;
}
}
return 0;
}
int main(void)
{
int values[30],i;
for (i = 0; i < 30; i++)
{
values[i] = rand()%100;
printf("%d ", values[i]);
}
select_sort(values, 30);
printf("\n");
for (i =0; i < 30; i++)
printf("%d ", values[i]);
return 0;
}
阅读(450) | 评论(0) | 转发(0) |