练习专区

今天的一小步就是明天的一大步
Problem 1145 信息表(共用体)
Accepted: 6   Total Submit: 40
Time Limit: 1000ms   Memory Limit: 30720KB
Description
有若干个老师和学生的数据,学生的数据中包括:姓名、号码、性别、职业、班级。教师的数据包括:姓名、号码、性别、职业、职务。可以看出,学生和教师所包含的数据是不同的。现要求把它们放在同一表格中。 然后按名字的字典序输出教师与学生的信息。结构如下: struct { int num; char name[10]; char sex; char job; union { int clas; char position[10]; }category; }person[N];
Input
先输入总人数N,然后有N行,每行有5 个数据被空格隔开。
Output
以名字的字典序按样例的方式输出。
Sample Input
6
1001 Li fmale student 101
1002 Wu male teacher professor
1003 Chen male student 101
1006 Li male student 101
1009 Wang fmale teacher associte_professor
1005 Xie fmale student 102
Sample Output
No   Name     sex   job      class/position
1003 Chen     male  student  101
1001 Li       fmale student  101
1006 Li       male  student  101
1009 Wang     fmale teacher  associte_professor
1002 Wu       male  teacher  professor
1005 Xie      fmale student  102
Hint
提交     返回