C++结构体问题

[复制链接]
查看11 | 回复2 | 2010-12-18 20:46:47 | 显示全部楼层 |阅读模式
我有一个人的信息,年龄17,体重55Kg,身高160cm,学历高中。
我现在定义一个结构体,把这些信息存进去,如何解决啊

回复

使用道具 举报

千问 | 2010-12-18 20:46:47 | 显示全部楼层
struct MPerson{uint age;// 年龄uint weigth;// 体重,可变为float类型uint height;// 身高CString degree;// 学历};先是定义,然后创建对象,赋值MPerson xx;xx.age=17;xx.weight=55;xx.height=160;xx.degree="高中“;
回复

使用道具 举报

千问 | 2010-12-18 20:46:47 | 显示全部楼层
struct information{int age;int weight;int height;char education[10];};struct information one;然后输入下。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行