#include"stdio.h"
int main()
{struct Student
{
int num;
char name[20];
float score;
}student1,student2;
printf("请分别输入两个学生的信息:\n");
scanf("%d,%s,%f",&student1.num,student1.name,&student1.score);
scanf("%d,%s,%f",&student2.num,student2.name,&student2.score);
if(student1.score>student2.score)
printf("%d,%s,%f\n",student1.num,student1.name,student1.score);
else if (student1.score==student2.score)
{printf("%d,%s,%f\n",student1.num,student1.name,student1.score);
printf("%d,%s,%f\n",student2.num,student2.name,student2.score);}
else
printf("%d,%s,%f\n",student2.num,student2.name,student2.score);
return 0;
}为什么这样输出结果会出错
而去掉scanf中的“,”就不会了,