#include <stdio.h>int main(){ int score[]={67,98,75,63,82,79,81,91,66,84}; int i; void sort(int a[]); void average(int a[]); average(score); sort(score); printf("max=%d,min=%d\nsort:",score[0],score[9]); for(i=0;i<10;i++) printf("%d ",score[i]); printf("\n"); return 0;}void average(int a[]){ int sum=0,i; for(i=0;i<10;i++) sum+=a[i]; float average=sum/10; printf("sum=%d\naverage=%.2f\n",sum,average);}void sort(int a[]){ int i,j; void exchange(int a,int b); for(i=0;i<10;i++) for(j=i+1;j<10;j++) exchange(a[i],a[j]);}void exchange(int a,int b){ int temp; if(a>b) { temp=a; a=b; b=temp; }}输出之后还是原顺序怎么回事
1 回答
- 1 回答
- 0 关注
- 867 浏览
添加回答
举报
0/150
提交
取消