正在加载图片...
[例9-1建立一个学生信息厍 void new student(struct student students [) struct student s 结构数组/指针作为形式参数 等价于 struct student* students if( count==MaxSize)I printf ("the array is ful l\n") return scanf ("%d",&s num 用运算符 scanf("%s", s name 使用结构成员变量 scanf("%d",&s math scanf("%",&. computer) scanf("%d",&s engl ish) tun:=6;结构变量可以整体赋值void new_student(struct student students[]) { struct student s; if( count==MaxSize ) { printf("The array is full\n"); return; } scanf("%d", &s.num); scanf("%s", s.name); scanf("%d", &s.math); scanf("%d", &s.computer); scanf("%d", &s.english); s.verage = ( s.math + s.computer + s.english ) / 3.0; students[count ++] = s; } 用运算符 . 使用结构成员变量 结构变量可以整体赋值 结构数组/指针作为形式参数 等价于struct student *students
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有