#include<stdio.h> struct student{ char name[10]; int num; char score[3]; }stu[5]; //结构体输入信息 int main(){ void print(struct student str[5]); int i,j; for(i=0;i<5;i++){ printf("第%d个学生信息如下:\n",i+1); printf("name:"); scanf("%s",&stu[i].name); for(j=0;j<3;j++){ printf("score %d : ",j+1); scanf("%d",&stu[i].score[j]); } printf("\n"); } print(stu); //函数输出结果 return 0; } void print(struct student str[5]) { int i,j; printf("name score1 score2 score3\n"); for(i=0;i<5;i++){ printf("%s",stu[i].name); for(j=0;j<3;j++){ printf("%7d",stu[i].score[j]); } printf("\n"); } }