Description
本题要求实现一个用选择法对整数数组进行简单排序的函数。
函数接口定义:
void sort( int a[], int n );
其中a是待排序的数组,n是数组a中元素的个数。该函数用选择法将数组a中的元素按升序排列,结果仍然在数组a中。
裁判测试程序样例:
#include
#define MAXN 10
void sort( int a[], int n );
int main()
{
int i, n;
int a[MAXN];
scanf(
Input
其中a是待排序的数组,n是数组a中元素的个数
Output
该函数用选择法将数组a中的元素按升序排列,结果仍然在数组a中。
After sorted the array is: 1 5 6 7