参考代码:

#include <stdio.h>

#include <stdlib.h>

struct student{

char id[20];

char name[20];

int a;

int b;

int c;

};




void  input(struct  student  *p){


  scanf("%s%s%d%d%d",p->id,p->name,&p->a,&p->b,&p->c);

}



void  output(struct  student  *p){

printf("%s,%s,%d,%d,%d\n",p->id,p->name,p->a,p->b,p->c);

}


int main()

{

//    cout << "Hello world!" << endl;

    struct  student buf[50],*p;

    int n;

    scanf("%d",&n);

    for(p=buf;p<buf+n;p++){

        input(p);

    }

     for(p=buf;p<buf+n;p++){

        output(p);

    }

    return 0;

}


 

0.0分

0 人评分

  评论区