正在加载图片...
【例11-2】输出结构体数据 include <stdio. h> void maino a"E:学习程序 Ctest \Debug\Ctes.口 struct stu input sex and score int num lame=Zhang ping char *name: core=86.000000 ress any key to continue char sex: float score: y boyl, boy2; boyl num=102 boyl. name=Zhang ping" printf(inputsex and scoreIn") scanf(%c %f", &boy l sex, &boy lscore); boy2=boyl printf( Number=%d\nName=%s\n", boy2 num, boy2 name); printf("Sex% Score=%fn", boy2 sex, boy2score);【例11-2】输出结构体数据 #include <stdio.h> void main() { struct stu { int num; char *name; char sex; float score; } boy1,boy2; boy1.num=102; boy1.name="Zhang ping"; printf("input sex and score\n"); scanf("%c %f",&boy1.sex,&boy1.score); boy2=boy1; printf("Number=%d\nName=%s\n",boy2.num,boy2.name); printf("Sex=%c\nScore=%f\n",boy2.sex,boy2.score); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有