peige


私信TA

用户名:peige

访问量:33765

签 名:

求你们别学啦,我跟不上

等  级
排  名 263
经  验 5711
参赛次数 0
文章发表 65
年  龄 20
在职情况 学生
学  校 华南农业大学
专  业 软件工程

  自我简介:

求你们别学啦,我跟不上

解题思路:





注意事项:





参考代码:

#include<stdio.h>

#define N 100

struct student

{

    char num[10];

    char name[10];

    int score[3];

};

void input(struct student *stu,int n)//把结构体变量正常对待即可

{

    int i;

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

        scanf("%s%s%d%d%d",stu[i].num,stu[i].name,stu[i].score,stu[i].score+1,stu[i].score+2);

//stu[i].score是score数组的首地址

}

void print(struct student *stu,int n)

{

    int i;

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

        printf("%s,%s,%d,%d,%d\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2]);

}

int main()

{

    struct student stu[N];

    int n;

    scanf("%d",&n);

    input(stu,n);

    print(stu,n);

    return 0;

}


 

0.0分

0 人评分

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

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区