WLJ


私信TA

用户名:hputermux

访问量:14388

签 名:

等  级
排  名 594
经  验 4080
参赛次数 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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区