第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

我寫的這個(gè)是不是有點(diǎn)繁瑣呀

#include <stdio.h>

int n=10;

int sumScore(int score[]){

? ? int i=0;

? ? int sum=0;

? ? for(i;i<n;i++)

? ? {

? ? ? ? sum+=score[i];

? ? }

? ? //printf("成績之和為:%d\n",sum);

? ? return sum;

}

double avrScore(int score[]){

? ? double avr=sumScore(score)/n;

? ? //printf("平均成績?yōu)椋?1.2f\n",avr);

? ? return avr;

}

int B_S(int score[]){

? ? int i,j;

? ? for(j=8;j>=0;j--){

? ? ? ? for(i=0;i<=j;i++){

? ? ? ? if(score[i]<score[i+1]){

? ? ? ? ? int temp;

? ? ? ? ? temp=score[i];

? ? ? ? ? score[i]=score[i+1];

? ? ? ? ? score[i+1]=temp;

? ? ? ? }

? ? }

? ? }

? ? for(i=0;i<n;i++)

? ? {

? ? ? ? printf("第%d名:%d\n",(i+1),score[i]);

? ? }

? ? return 0;

? ??

}

int bigScore(int score[]){

? ?int i,j;

? ? for(j=8;j>=0;j--){

? ? ? ? for(i=0;i<=j;i++){

? ? ? ? if(score[i]<score[i+1]){

? ? ? ? ? int temp;

? ? ? ? ? temp=score[i];

? ? ? ? ? score[i]=score[i+1];

? ? ? ? ? score[i+1]=temp;

? ? ? ? }

? ? }

? ? } ?

? ??

? ?return score[0];?

? ?

}

int smallScore(int score[]){

? ? int i,j;

? ??

? ? ? ? for(i=0;i<=j;i++){

? ? ? ? if(score[i]<score[i+1]){

? ? ? ? ? int temp;

? ? ? ? ? temp=score[i];

? ? ? ? ? score[i]=score[i+1];

? ? ? ? ? score[i+1]=temp;

? ? ? ??

? ? ? ? ?}

? ? }?

? ? return score[n-1];

}


int main()

{

? ?

? ? int score[10]={67,98,75,63,82,79,81,91,66,84};

? ? printf("總成績?yōu)椋?d\n",sumScore(score));

? ? printf("平均成績?yōu)椋?1.2f\n",avrScore(score));

? ? printf("最高成績:%d\n",bigScore(score));

? ? printf("最低成績:%d\n",smallScore(score));

? ? printf("成績排名情況:\n");

? ? B_S(score);

? ? return 0;

}


正在回答

1 回答

= =..確實(shí)有點(diǎn)。。。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

paddy 提問者

怎么改善下。。。
2015-02-08 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Fiona0126 回復(fù) paddy 提問者

最高分和最低分沒必要排序。。另外也可以調(diào)整排序的位置。這樣可以很快的找出max和min。。有興趣的話看一下我的代碼。僅供參考= =。
2015-02-08 回復(fù) 有任何疑惑可以回復(fù)我~
#3

俠客島的含笑 回復(fù) Fiona0126

int cmp(const void *a,const void *b){ return *(int*)b - *(int*)a; }這個(gè)我看不懂,姐姐能指點(diǎn)一二嗎??
2016-02-22 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

我寫的這個(gè)是不是有點(diǎn)繁瑣呀

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號