WLJ


私信TA

用户名:hputermux

访问量:14981

签 名:

等  级
排  名 600
经  验 4139
参赛次数 4
文章发表 43
年  龄 20
在职情况 学生
学  校 河南理工大学
专  业 计算机专业

  自我简介:

计算机科学与技术专业

TA的其他文章

解题思路:结构体

注意事项:

参考代码:

#include<stdio.h>

struct student

{

    char id[20];

    char name[20];

    int score1;

    int score2;

    int score3;

};

int main()

{

    struct student stu[1003];

    int n;

    int i;

    scanf("%d",&n);

    getchar();

    for(i = 0;i<n;i++)

    {

        scanf("%s",stu[i].id);

        getchar();

        scanf("%s",stu[i].name);

        scanf("%d %d %d",&stu[i].score1,&stu[i].score2,&stu[i].score3);

        getchar();

    }

    for(i = 0;i<n;i++)

    {

        printf("%s,",stu[i].id);

        printf("%s,",stu[i].name);

        printf("%d,%d,%d\n",stu[i].score1,stu[i].score2,stu[i].score3);

    }

    return 0;

}


 

0.0分

0 人评分

  评论区