源自:6-12 综合练习
终于搞出来了
#include <stdio.h>
#include <stdlib.h>
int test(int array[]){
//int array[10] = {89,67,43,90,98,42,65,87,56,76};
int count = 9;
int all_score=0;
int average_score=0;
int highest_score=0;
int lowest_score=0;
int a;
for(a=0;a<(count+1);a++){
all_score += array[a];
}
average_score = all_score / (count + 1);
int aaa,bbb;
int tempaaa;
int arraaa[10]={89,67,43,90,98,42,65,87,56,76};
for(aaa=9;aaa>=0;aaa--){
for(bbb=0;bbb<aaa;bbb++){
if(arraaa[bbb]<arraaa[bbb+1]){
tempaaa = arraaa[bbb];
arraaa[bbb] = arraaa[bbb+1];
arraaa[bbb+1] = tempaaa;
}
}
}
printf("\n-------降序排序之后------\n");
int ccc;
for(ccc=0;ccc<10;ccc++){
printf("\n%d",arraaa[ccc]);
}
highest_score=arraaa[0];
lowest_score=arraaa[count];
printf("\n\n\n最大数为%d,最小数为%d,总数为%d,平均数为%d",highest_score,lowest_score,all_score,average_score);
}
int main(){
int array[10] = {89,67,43,90,98,42,65,87,56,76};
test(array);
}
提问者:qq_慕虎2485483
2024-06-21 16:36