从键盘输入两个学生的学号


#include 
struct Student
{
    char sno[20];
    char name[20];
    float score;
};
int main()
{
    /***** 在以下一行填写代码 *****/
    

    scanf("%s %s %f",&student1.sno,&student1.name,&student1.score);

    scanf("%s %s %f",&student2.sno,&student2.name,&student2.score);

    /***** 在以下一行填写代码 *****/
    if()
        printf("%s %s %.1f",student1.sno,student1.name,student1.score);
    else
        printf("%s %s %.1f",student2.sno,student2.name,student2.score);
    
    return 0;
}

img


中间绿色空的地方应该填什么啊,预期输出结果在图片里,希望可以帮解决一下!

struct Student student1;  // 结构体变量 student1
struct Student student2; // 结构体变量 student2

if (student1.score > student2.score)   // student1的成绩 大于  student2的成绩

望采纳,需要在上述代码中填写以下内容:

创建两个Student结构体变量:

Student student1;
Student student2;

在if语句中填充条件表达式,用于判断哪个学生的成绩更高:

if (student1.score > student2.score)

最终,完整的代码如下所示:

#include <stdio.h>
struct Student
{
    char sno[20];
    char name[20];
    float score;
};
int main()
{
    Student student1;
    Student student2;
 
    scanf("%s %s %f",&student1.sno,&student1.name,&student1.score);
 
    scanf("%s %s %f",&student2.sno,&student2.name,&student2.score);
 
    if (student1.score > student2.score)
        printf("%s %s %.1f",student1.sno,student1.name,student1.score);
    else
        printf("%s %s %.1f",student2.sno,student2.name,student2.score);
    
    return 0;
}

1.struct Student student1,student2;
2.if(student1.score>student2.score)