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

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

這個(gè)代碼有什么問題?

#include?<stdio.h>
int?total(int?score[])
{
????int?sum;
????int?size?=?sizeof(score);
????for(int?i=0;?i<size;?i++)
????{????
????????sum?+=?score[i];
????}
????return?sum;
}
int?max(int?score[])
{
????int?max,?item;
????int?size?=?sizeof(score);?
????for(int?i=0;?i<size;?i++)
????{
????????item?=?score[i];
????????if(item?>?max)
????????{
????????????max?=?item;
????????}
????}
}
int?min(int?score[])
{
????int?min,?item;
????int?size?=?sizeof(score);
????for(int?i=0;?i<size;?i++)
????{
????????item?=?score[i];
????????if(item?<?min)
????????{
????????????min?=?item;
????????}
????}
}
int?average(int?score[])
{
????return?(float)total(score)?/?sizeof(score);
}
void?sort(int?score[])
{
????int?i,?temp,?flag;
????int?size?=?sizeof(score);?
????while(flag)
????{
????????flag?=?0;
????????for(i=0;?i<size-1;?i++)
????????{
????????????if(score[i]?>?score[i+1])
????????????{
????????????????//?交換兩元素
????????????????temp?=?score[i];
????????????????score[i]?=?score[i+1];
????????????????score[i+1]?=?temp;
????????????????flag?=?1;
????????????????}
????????????}
????????}
}
void?printScore(int?score[])
{
????int?size?=?sizeof(score);
????for(int?i=0;?i<size;?i++)
????{
????????printf("?%d",?score[i]);
????}
????printf("\n")
}
int?main()
{
????int?score[N]={67,98,75,63,82,79,81,91,66,84};
????printf("Test?function?total():?total(score)=%d\n",?total(score));
????printf("Test?function?max():?max(score)=%d\n",?max(score));
????printf("Test?function?min():?min(score)=%d\n",?min(score));
????printf("Test?function?average():?average(score)=%d\n",?average(score));
????printf("Test?function?sort():?sort(score)=");
????sort(score);
????printScore(score);
????return?0;
}


運(yùn)行失敗

hello.c:?In?function?'total':
hello.c:5:22:?warning:?'sizeof'?on?array?function?parameter?'score'?will?return?size?of?'int?*'?[-Wsizeof-array-argument]
?????int?size?=?sizeof(score);
??????????????????????^
hello.c:2:15:?note:?declared?here
?int?total(int?score[])
???????????????^~~~~
hello.c:?In?function?'max':
hello.c:15:22:?warning:?'sizeof'?on?array?function?parameter?'score'?will?return?size?of?'int?*'?[-Wsizeof-array-argument]
?????int?size?=?sizeof(score);
??????????????????????^
hello.c:12:13:?note:?declared?here
?int?max(int?score[])
?????????????^~~~~
hello.c:?In?function?'min':
hello.c:28:22:?warning:?'sizeof'?on?array?function?parameter?'score'?will?return?size?of?'int?*'?[-Wsizeof-array-argument]
?????int?size?=?sizeof(score);
??????????????????????^
hello.c:25:13:?note:?declared?here
?int?min(int?score[])
?????????????^~~~~
hello.c:?In?function?'average':
hello.c:40:40:?warning:?'sizeof'?on?array?function?parameter?'score'?will?return?size?of?'int?*'?[-Wsizeof-array-argument]
?????return?(float)total(score)?/?sizeof(score);
????????????????????????????????????????^
hello.c:38:17:?note:?declared?here
?int?average(int?score[])
?????????????????^~~~~
hello.c:?In?function?'sort':
hello.c:45:22:?warning:?'sizeof'?on?array?function?parameter?'score'?will?return?size?of?'int?*'?[-Wsizeof-array-argument]
?????int?size?=?sizeof(score);
??????????????????????^
hello.c:42:15:?note:?declared?here
?void?sort(int?score[])
???????????????^~~~~
hello.c:?In?function?'printScore':
hello.c:64:22:?warning:?'sizeof'?on?array?function?parameter?'score'?will?return?size?of?'int?*'?[-Wsizeof-array-argument]
?????int?size?=?sizeof(score);
??????????????????????^
hello.c:62:21:?note:?declared?here
?void?printScore(int?score[])
?????????????????????^~~~~
hello.c:70:1:?error:?expected?';'?before?'}'?token
?}
?^
hello.c:?In?function?'main':
hello.c:73:15:?error:?'N'?undeclared?(first?use?in?this?function)
?????int?score[N]={67,98,75,63,82,79,81,91,66,84};
???????????????^
hello.c:73:15:?note:?each?undeclared?identifier?is?reported?only?once?for?each?function?it?appears?in


正在回答

1 回答

#include?<stdio.h>
#include?<stdlib.h>
#define?N?10int?cmp(const?void?*a,const?void?*b){????return?*(int*)b?-?*(int*)a;}int?Sum(int?score[]){????int?s?=?0,i;????for(i?=?0?;?i?<?N?;?i++)????????s?+=?score[i];????return?s;}int?Max(int?score[]){????return?score[0];}int?Min(int?score[]){????return?score[N-1];}double?Avg(int?s){????return?(s?+?0.0)?/?N;}int?main(){????int?score[N]={67,98,75,63,82,79,81,91,66,84};????int?i,sum;????sum?=?Sum(score);????qsort(score,N,sizeof(int),cmp);//sort?it????printf("Total?score?:?%d\n",sum);????printf("Max?score?:?%d\n",Max(score));????printf("Min?Score?:?%d\n",Min(score));????printf("Average?score?:?%f\n",Avg(sum));????printf("\n成績(jī)排序:\n");????for(i?=?0?;?i?<?N?;?i++)????{????????printf("Rank?%d's?score?:?%d\n",i+1,score[i]);????}????return?0;}


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

舉報(bào)

0/150
提交
取消
C語言入門
  • 參與學(xué)習(xí)       926892    人
  • 解答問題       21442    個(gè)

C語言入門視頻教程,帶你進(jìn)入編程世界的必修課-C語言

進(jìn)入課程

這個(gè)代碼有什么問題?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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