c语言编程,输入5个人的名字,学号,成绩,把高于60分的找出来

如题所述

#include <stdio.h>
struct stu{
    char no[20];
    char name[50];
    int score;
};
int main()
{
    struct stu s[5];
    int i;
    for(i = 0; i < 5; i ++)
    {
        printf("input %d student's number:", i+1);
        scanf("%s", s[i].no);
        printf("input %d student's name:", i+1);
        gets(s[i].name);
        printf("input %d student's score:", i+1);
        scanf("%d",&s[i].score);
    }
    for(i = 0; i < 5; i ++)
        if(s[i].score > 60) printf("%s %s %d\n", s[i].no, s[i].name, s[i].score);
    return 0;
}
温馨提示:答案为网友推荐,仅供参考
相似回答