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

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

請(qǐng)問(wèn)一下我這個(gè)哪里有問(wèn)題?

#include <stdio.h>

int N;

int totalsc(int score[]){

? ? int i,total;

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

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

? ? }

? ? return total;

}


int maxsc(int score[]){

? ? int i,max;

? ? max=score[0];

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

? ? ? ? if(score[i]>max)

? ? ? max=score[i];

? ? }

? ? return max;

}


int minsc(int score[]){

? ? int i,min;

? ? min=score[0];

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

? ? ? ? if(score[i]<min)

? ? ? min=score[i];

? ? }

? ? return min;

}


int avgsc(int score[]){

? ?int i,total,avg;

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

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

? ? }?

? ? avg=total/N;

? ? return avg;

}


int sort(int score[]){

? ? int i,temp;

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

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

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

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

? ? ? ? score[i]=temp;

? ? }

? ? return score[i];

? ? printf("考試排名%d",score[i]);

}

int main()

{

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

? ?int min,max,avg,total;

? ?N=10;

? ?min=minsc(score);

? ?max=maxsc(score);

? ?avg=avgsc(score);

? ?total=totalsc(score);

? ? printf("總分為:%d",total);

? ? printf("最高分%d,最低分%d,平均分%d",max,min,avg);

? ? sort(score);

? ??

? ? return 0;

}


正在回答

3 回答

sort 里面的?if(score[i]<score[i+1])? ?如果i是9 的話,i+1就是10? 數(shù)組越界了

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

前面加個(gè)#define N 10

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

未定義N=10

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

舉報(bào)

0/150
提交
取消

請(qǐng)問(wèn)一下我這個(gè)哪里有問(wèn)題?

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