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

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

最后一題,求解,運(yùn)行不了,老是有錯(cuò)誤。

#include?<stdio.h>
int?main()
{
????int?i;
????int?score[10]={67,98,75,63,82,79,81,91,66,84};
????int?sum=SUM(score);
????printf("%d,%d,%d,%lf\n",SUM(score),Max(score),Min(score),Ave(sum));
????Max(score);
????for(i=0;i<=9;i++)
????printf("%d?",score[i]);
????return?0;
}
int?SUM(int?score[10])
{
????int?i;
????int?sum=0;
????for(i=0;i<=9;i++)
????{
????????sum+=score[i];
????}
????return?sum;
}
int?Max(int?score[10])
{
????int?i,j,temp;
????for(i=8;i<=0;i--)
????{
????????for(j=0;j<=i;j++)
????????{
????????????if(score[j]>=score[j+1])
????????????temp=score[j];
????????????score[j]=score[j+1];
????????????score[j+1]=temp;
????????}
????}
????return?score[9];
}
int?Min(int?score[10])
{
????int?i,j,temp;
????for(i=8;i<=0;i--)
????{
????????for(j=0;j<=i;j++)
????????{
????????????if(score[j]>=score[j+1])
????????????temp=score[j];
????????????score[j]=score[j+1];
????????????score[j+1]=temp;
????????}
????}
????return?score[0];
}
double?Ave(int?sum)
{
????double?ave;
????ave=sum/10;
????return?ave;
}

求大神解答。

正在回答

2 回答

#include <stdio.h>

int main()

{

? ? int i;

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

? ? int sum=SUM(score);

? ? printf("%d,%d,%d,%d\n",SUM(score),Max(score),Min(score),Ave(sum));

? ? Max(score);

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

? ? printf("%d ",score[i]);

? ? return 0;

}

int SUM(int score[10])

{

? ? int i;

? ? int sum=0;

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

? ? {

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

? ? }

? ? return sum;

}

int Max(int score[10])

{

? ? int i,j,temp;

? ? for(i=8;i>=0;i--)

? ? {

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

? ? ? ? {

? ? ? ? ? ? if(score[j]>score[j+1])

? ? ? ? ? ? {

? ? ? ? ? ? ? ? temp=score[j];

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

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

? ? ? ? ? ? }

? ? ? ? }

? ? }

? ? return score[9];

}

int Min(int score[10])

{

? ? int i,j,temp;

? ? for(i=8;i>=0;i--)

? ? {

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

? ? ? ? {

? ? ? ? ? ? if(score[j]>score[j+1])

? ? ? ? ? ? {

? ? ? ? ? ? ? ? temp=score[j];

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

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

? ? ? ? ? ? }

? ? ? ??

? ? ? ? }

? ? }

? ? return score[0];

}

int Ave(int sum)

{

? ? int ave;

? ? ave=sum/10;

? ? return ave;

}


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

天蟲(chóng)

我給你細(xì)調(diào)了一下,現(xiàn)在就可以了,我先把我改動(dòng)的細(xì)節(jié)說(shuō)一下:一、Ave函數(shù)的類(lèi)型我改成了整型,這也是你函數(shù)的編譯問(wèn)題,把這個(gè)改正之后你的結(jié)果就能顯示出來(lái)了,但是你顯示的結(jié)果并不符合題目的的要求,這就是你函數(shù)的邏輯錯(cuò)誤了,也是第二點(diǎn);二、在函數(shù)max和min中的if語(yǔ)句后面沒(méi)有加上{},導(dǎo)致了邏輯問(wèn)題(我也出過(guò)類(lèi)似的問(wèn)題),加上之后結(jié)果正確了。希望對(duì)你有幫助,加油!
2016-02-05 回復(fù) 有任何疑惑可以回復(fù)我~

你的自定義函數(shù)沒(méi)有在開(kāi)頭進(jìn)行函數(shù)說(shuō)明

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

舉報(bào)

0/150
提交
取消

最后一題,求解,運(yùn)行不了,老是有錯(cuò)誤。

我要回答 關(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)