#include<stdio.h>void sort(int *x,int n);int main(){int arr[10] = { 11,3,7,23,15,79,66,58,69,45 },i;sort(arr, 10);printf("排序结果如下:\n");for (i = 0; i < 10; i++)printf("%d ", arr[i]);return 0;}void sort(int *x, int n){int i, j, k, t;for (i = 0; i < n - 1; i++){k = i;for (j = i + 1; j < n; j++)if (x[j] < x[k])k = j;if (i != k){t = x[i];x[i] = x[k];x[k] = t;}}}
1000字范文,内容丰富有趣,学习的好帮手!