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

為了賬號安全,請及時綁定郵箱和手機立即綁定

哪錯了哪錯了

#include <stdio.h>

int main()

{

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

? ? printf("總分是%d\n最高分是%d\n最低分是%d\n平均分是%f\n",

? ? zongfen(score[10]),zuigao(score[10]),zuidi(score[10]),pingjun(score[10]));

? ? return 0;

}

int zongfen(score)

{

? ? int sum=0;

? ? int a=0;

? ? if(a<10;a++)

? ? {

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

? ? ? ? a++;

? ? }

? ? return sum;

}

int pingjun(score)

{

? ? int sun=0;

? ? int b=0;

? ? if(b<10;b++)

? ? {

? ? ? ? sun+=score[b];

? ? }

? ? return sun/10;

}

int zuigao(score)

{

? ? int c=0;

? ? int max=score[0];

? ? for(c<10;c++)

? ? {

? ? ? ? if(max<score[c])

? ? ? ? {

? ? ? ? ? ? max=score[c];

? ? ? ? }

? ? }

? ? return max;

}

int zuidi(score)

{

? ? int d=0;

? ? int min=score[0];

? ? for(d<10;d++)

? ? {

? ? ? ? if(min>score[d])

? ? ? ? {

? ? ? ? ? ? min=score[d];

? ? ? ? }

? ? }

? ? return min;

}


正在回答

1 回答

#include <stdio.h>

#define N 10

int main()

{

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

? ? int i,j;

? ? int Max=0,Min=score[0],temp;

? ? float Mid=0,Sum=0;

? ? for(i=0;i<N;i++)Sum+=score[i]; //總成績

? ? Mid=Sum/N;//平均分

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

? ? {

? ? ? ? if(score[i]>Max)Max=score[i]; //最高

? ? ? ? if(score[i]<Min)Min=score[i]; //最低

? ? }

? ? for(i=N-1-1;i>=0;i--)//冒泡排序N-下標-1

? ? {

? ? ? ? for(j=0;j<=i;j++)//前一個與后一個比較,直到最后

? ? ? ? {

? ? ? ? ? ? if(score[j]<score[j+1])//前一個小于后一個則進行交換

? ? ? ? ? ? {

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

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

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

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? }

? ? ? ?

? ? }

? ? printf("總分:%.1f分\n最高分:%d分\n最低分:%d分\n平均分:%.1f分\n",Sum,Max,Min,Mid);

? ? printf("冒泡法降序排序:");

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

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

? ? ? ??

? ? return 0;

}


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

舉報

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

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

進入課程

哪錯了哪錯了

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

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

幫助反饋 APP下載

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

公眾號

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