标题:
C语言经典算法之数据结构1
[打印本页]
作者:
苹果也疯狂
时间:
2014-5-22 09:57
标题:
C语言经典算法之数据结构1
#include <stdio.h>
void main()
{
struct childrec/*
定义结构体
*/
{
char initial; /*
姓名首字母
*/
int age; /*
年龄
*/
int grade; /*
考试成绩
*/
}boy,girl;
boy.initial = 'R';
boy.age = 15;
boy.grade = 75;
girl.age = boy.age - 1; /*
女孩比男孩小一岁
*/
girl.grade = 82;
girl.initial = 'H';
printf(" girl: %c is %dyears old and got a grade of %d\n",
girl.initial, girl.age, girl.grade);
printf(" boy: %c is %d years old and got a grade of%d\n",
boy.initial, boy.age, boy.grade);
}
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0