回复 2楼 小跳蚤
#include<stdio.h>
struct student
{
int number;
char name[20];
int score[3];
}stu[3];
void main()
{
int i;
struct student *p;
void average(struct student *);
p=stu;
printf("
\nPlease input 10 students xinxi\n\n");
printf("
xuehao
name
yuwen
shuxue
yingyu\n");
for(i=0;i<3;i++,p++)
{
scanf("%d,%s,%d,%d,%d\n",&p->number,p->name,&p->score[0],&p->score[1],&p->score[2]);
}
p=stu;
average(p);
}
void average(struct student *q)
{
int i,sum;
for(i=0;i<3;i++,q++)
{
sum=(q->score[0]+q->score[1]+q->score[2])/3;
printf("%d
%s
%d\n",q->number,q->name,sum);
}
}能顺便看下这个程序么 后面的p->score【i】 在scanf那里总是读不进数据