最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

為什么這樣寫算不出正確的最低分?

#include <stdio.h>

int ALL(int score[])

{

? ? int num=0;

? ? int i;

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

? ? {

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

? ? }

? ? return num;

}


int TOP(int score[])

{

int i;

int j;

for(j=0;j<9;j++)

{

for(i=0;i<9;i++)

{

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

{

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

}

}

}

return score[0];

}


int LOW(int score[])

{

int i;

int j;

int min;

for(j=0;j<9;j++)

{

for(i=0;i<9;i++)

{

if(score[i]>score[i+1])

{

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

}

}

}

return score[0];

}


int main()

{

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

? ? printf("總分%d\n",ALL(score));

? ? printf("最高分%d\n",TOP(score));

? ? printf("最低分%d\n",LOW(score));

? ? return 0;

}


正在回答

1 回答

for(j=0;j<9;j++)

for(i=0;i<9;i++)

if(score[i]>score[i+1])

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

這是你寫的最低分的代碼,問(wèn)題出在只用比較一趟就可以,就是

for(i=0;i<10;i++)

if(score[i]>score[i+1])

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


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

Steve_64 提問(wèn)者

為什么只要比較一趟?
2018-07-27 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么這樣寫算不出正確的最低分?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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