我哪里出現(xiàn)問(wèn)題了?
#include <stdio.h>
int a()
{
? ? int score[10]={55,96,94,67,51,83,84,61,67,89};
? ? int i;
? ? for(i=0;i<9;i++)
? ? {
? ? ? ? score[i + 1] =score[i+1] + score[i];
? ? }
? ? printf("考試的總分是:%d\n\n平均分是:%d\n\n",score[9],score[9]/10);
? ? return 0;
}
int b()
{
? ? int score[10]={55,96,94,67,51,83,84,61,67,89};
? ? int j,max;
? ? max=score[0];
? ? for(j=1;j<10;j++)
? ? {
? ? ? ? if(score[j]>max)
? ? ? ? max=score[j];
? ? }
? ? printf("考試的最高分是:%d\n\n",max);
? ? return 0;
}
int c()
{
? ? int score[10]={55,96,94,67,51,83,84,61,67,89};
? ? int k,min;
? ? min=score[0];
? ? for(k=0;k<9;k++)
? ? {
? ? ? ? if(score[k]<min)
? ? ? ? min=score[k];
? ? }
? ? printf("考試的最低分是:%d\n\n",min);
? ? return 0;
}
int d()
{
? ?int score[10]={55,96,94,67,51,83,84,61,67,89};
? ?int x,y,z;
? ?for(x=0;x<9;x++)
? ?{
? ? ? ?for(y=0;y<9-x;y++)
? ? ? ?if(score[y]>score[y+1])
? ? ? ?{
? ? ? ? ? ?z=score[y];
? ? ? ? ? ?score[y] =score[y+1];
? ? ? ? ? ?score[y+1]=z;
? ? ? ? }
? ?}
? ?printf("考試成績(jī)降序?yàn)?\n");
? ?for(y=0;y<10;y++)
? ?{
? ? ? ?printf("%d ",score[y]);
? ?}
? ?printf("\n\n");
? ?return 0;
}
int main
{
? ? a();
? ? b();
? ? c();
? ? d();
}
2019-07-18
最后應(yīng)該寫成? int main()
2019-06-25
int main后面沒(méi)有括號(hào),應(yīng)該改為int main()??????????????這樣就對(duì)了。