第7章结构体与链表讲述.ppt

7.5 结构体与函数 7.6 链表 7.7 共用体和枚举类型 7.8 类型定义符typedef的用法 void main( ) { struct stu st[N]; int i; printf(请输入%d个学生的信息:\n, N); for(i=0; iN; i++) scanf(“%d%s%d”, st[i].num, st[i].name, st[i].score); sort(st); //函数调用,将数组st的首地址传给形参x printf(按成绩高低顺序输出学生信息:\n); for(i=0; iN; i++) printf(%d, %s, %d\n, st[i].num, st[i].name, st[i].score); } 【例7.3】程序改进:将3个功能分别编写3个函数实现 #includestdio.h #define N 40 //定义符号常量N,表示学生人数 struct student //定义结构体类型 { int num; char name[12]; int score[3]; int total; }; void input( struct stud

文档评论(0)

1亿VIP精品文档

相关文档