#include truct student float score printf("输入姓名:") printf("输入性别:") stusex=getchar; printf("输入年龄:") scanf("%d", &stu. age printf("输入成绩:") scanf("%f", &stu score) printf("姓名:%s,性别:%,年龄:%d,成绩:%2rn", stu name; stu. sex,stu.age,stu. score)
#include main() { struct student { char name[20]; char sex; int age; float score; }stu; printf("输入姓名:"); gets(stu.name); printf("输入性别:"); stu.sex=getchar(); printf("输入年龄:"); scanf("%d",&stu.age); printf("输入成绩:"); scanf("%f",&stu.score); printf("姓名:%s,性别:%c,年龄:%d,成绩:%5.2f\n",stu.name,stu.sex,stu.age,stu.score); }