返回信息流# include <stdio.h>
struct student
{
int age;
float score;
char sex;
};
int main(void)
{
struct student st = {80, 66.6, 'F'};//定义的同时赋值
struct student st2;
st2.age = 10;
st2.score = 88;
st2.sex = 'F';
printf("%d %f %c\n", st.age, st.score, st.sex);
printf("%d %f %c\n", st2.age, st2.socre, st2.sex);
return 0;
}
这是一条镜像帖。来源:北邮人论坛 / cpp / #93540同步于 2016/9/24
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
做一个结构体练习 不知道哪里错了 求帮助
thuuwooh11
2016/9/24镜像同步13 回复
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
第二个 score 拼写错了: score not socre
printf("%d %f %c\n", st.age, st.score, st.sex);
printf("%d %f %c\n", st2.age, st2.socre, st2.sex);
printf("%d %f %c\n", st2.age, st2.socre, st2.sex);
确实,不好看出来,score写错了。
应该会有报警信息吧,最好也附上。