SELECT.C
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
- #include <stdio.h>
- #include <stdlib.h>
- void selection_sort(int array[], int size)
- {
- int temp, current, j;
- for (current = 0; current < size; current++)
- for (j = current + 1; j < size; j++)
- if (array[current] > array[j])
- {
- temp = array[current];
- array[current] = array[j];
- array[j] = temp;
- }
- }
- void main(void)
- {
- int values[30], i;
- for (i = 0; i < 30; i++)
- values[i] = rand() % 100;
- selection_sort(values, 30);
- for (i = 0; i < 30; i++)
- printf("%d ", values[i]);
- }