|
2鱼币
求解答可以这样scanf给赋值吗?if下面的判断行不通 怎样输入都是 两个数相等
怎样解决下面判断大小,哪里错了
# include <stdio.h>
struct student
{
int num;
char name[20];
float score;
}student1,student2;
int main(void)
{
struct student1;
struct student2;
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("%s %f\n",student1.name, student1.score);
}
else if(student1.score < student2.score)
{
printf("%s %f\n",student2.name, student2.score);
}
else if(student1.score == student2.score)
{
printf("他们两个人的成绩相等");
}
}
我运行的结果 怎样输入都是他们两人成绩相等
|
|