#include <stdio.h>
int main()
{
int score[3];
int i,x,temp;
for(i=0;i<4;i++);
{
Receive data:scanf("%d",&temp);
if(temp>120) printf("%d请输入正确分数\n",temp) goto Receive data;
score[i]+temp
}
x=score[1]+score[2]+score[3];
if(x<220) printf("%d此学生分数太低请重新输入\n",x)
if(score[1]<score[2]) if(score[2]<score[3]) printf("%d此学生英语最好",score[3]);
else if(score[2]>score[3]) printf("%d此学生数学最好",score[2]);
if(score[1]>score[2]) if(score[1]>score[3]) printf("%d此学生语文最好",score[1]);
else if(score[1]<score[3]) printf("%d此学生英语最好",score[3]);
if(score[1]=score[2]) if(score[1]>score[3]) printf("%d此学生语文最好",score[1]);
else if(score[1]<score[3]) printf("%d此学生英语最好",score[3]);
getch();
}
首先要注意格式。。
goto语句设置的label设置有问题,中间不能有空格
for循环写完for(;;)后 不要加 ;
第一个for语句想要循环3次却循环了4次
score[i]+temp应该是想要将temp的值给score[i]吧。。
if内的语句如果超过了一句,那么就要用 { } 把if里的语句括起来,下面会有例子
漏了一些分号,把一些;打成了中文的;
getchar(),不是getchar()
判断两个相等需要用 == 而不是=
goto最好少用 或者不用
数组只有在定义的时候是告诉计算机有多少个,而在使用单个元素时:
比如说 定义一个整形数组a,有3个元素 int a[3];其中每个元素是a[0],a[1],a[2],而不是a[1],a[2],a[3]
使用int main()时,在程序最后要加上return 0;
下面是修改后的程序,如果对你有帮助,望采纳( ”//“之后为注释)
#include <stdio.h>