各位这个结构体输出有什么问题呢
课程设计
1
-
#include<stdio.h> struct stu { int num; char name[20]; char sex; float score; }boy[5] = { {1,"a",'m',100}, {2,"b",'m',80}, {3,"c",'m',60}, {4,"d",'m',40}, {5,"e",'m',20}, }; int main() { struct stu *ps; printf("NO\tName\tSex\tScore\n"); for (ps = boy; ps < boy + 5; ps++) { printf("%d\t", ps->num); printf("%s\t", ps->name); printf("%c\t", ps->sex); printf("%f\n", ps->score); } }
发表回复