| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

#include <stdio.h>
#include <math.h>
struct teacher
{
int gznum;                    /* 工资卡号 */
char name[20];               /* 姓名 */
int sex;                     /* sex=1(男),0(女) */
int year,month;             /* 出生年月 */
union marriage
{
char marriage[20];
}u1,u2;
}teachers;
int main()
{
printf("Enter gznum:\n");
scanf("%d",&teachers.gznum);
printf("Enter name:\n");
scanf("%s",&teachers.name[20]);
printf("Enter sex(1/0):\n");
scanf("%d",&teachers.sex);
printf("Enter born of year-month:\n");
scanf("%d-%d",&teachers.year,&teachers.month);

printf("%d\t%s\t%d\t%d-%d\t%d\n",teachers.gznum,teachers.name[20],teachers.sex,teachers.year,teachers.month,teachers.u1.marriage[20]);
return 0;
}

scanf("%s",&teachers.name[20]);

scanf("%s",teachers.name);

printf("%d\t%s\t%d\t%d-%d\t%d\n",teachers.gznum,teachers.name[20],teachers.sex,teachers.year,teachers.month,teachers.u1.marriage[20]);

printf("%d\t%s\t%d\t%d-%d\t%s\n",teachers.gznum,teachers.name,teachers.sex,teachers.year,teachers.month,teachers.u1.marriage);

• 2
• 1/1页
• 1