摘要: 在一个结构体数组中存入十个人的姓名及年龄,按照年纪升序排列并输出每个人的名字与年龄。 #include <stdio.h> #include <stdlib.h> #include <string.h> int at; char mt[20]; struct student{ char name[2 阅读全文
posted @ 2017-11-05 22:48 梦醒青春时 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 定义一个结构体变量(包括年、月、日)。编写一个函数DAYS,计算该日期在本年中是第几天(注意闰年问题)。 由主函数将年月日传递给DAYS函数,计算之后,将结果传回到主函数输出。 #include <stdio.h> #include <stdlib.h> int days; struct ymd{ 阅读全文
posted @ 2017-11-05 22:45 梦醒青春时 阅读(457) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <stdlib.h> struct Salary{ char name[20]; int years; int salary; }stu[5]; int main() { // struct Salary stu[5]; int i; prin 阅读全文
posted @ 2017-11-05 22:09 梦醒青春时 阅读(2405) 评论(0) 推荐(0) 编辑
摘要: c语言如果需要不同类型的一个集合时,数组就不能用,这时候我们就会用结构体struct; 1.结构体的定义: struct 结构体名 {成员列表}; 结构体名,用作结构体类型的标志,它又称 结构体标记,大括号内是该结构体中的各个成员,由它们组成一个结构体,对各成员都应进行类型声明如: 类型名 成员名; 阅读全文
posted @ 2017-11-05 22:04 梦醒青春时 阅读(205) 评论(0) 推荐(0) 编辑