结构体与链表程编题及解答.docVIP

  • 21
  • 0
  • 约8.62千字
  • 约 11页
  • 2017-03-02 发布于四川
  • 举报
结构体与链表程编题及解答

结构体与共用体 【程序1】 题目:编写input()和output()函数输入,输出5个学生的数据记录。(用结构体设计,学生记录中包括学号、姓名、四门课程成绩) 程序源代码: #include stdio.h #define N 5 struct student { char num[6]; char name[8]; int score[4]; } stu[N]; void input(struct student stu[]); void print(struct student stu[]); void main() { input(stu); print(stu); } void input(struct student stu[]) { int i,j; for(i=0;iN;i++) { printf(\nplease input %d of %d\n,i+1,N); printf(num: ); scanf(%s,stu[i].num); printf(name: ); scanf(%s,stu[i].name); for(j=0;j3;j++) { printf(score %d.,j+1); scanf(%d,stu[i].score[j]); } printf(\n);

文档评论(0)

1亿VIP精品文档

相关文档