scanf("%c",...)问题请教!!!!!!
#include<stdio.h>#include<stdlib.h>
struct date
{
short int year;
char month;
char day;
};
struct emp
{
char name[10];
char addr[20];
char sex;
struct date birthday;
};
int main()
{
struct emp emp1;
printf("请输入员工信息:\n");
printf("请输入姓名:");
scanf("%s",emp1.name);
printf("\n请输入住址:");
scanf("%s",emp1.addr);
printf("%d\n",&emp1.sex);
printf("\n请输入性别(1-男,0-女):");
scanf("%c",&emp1.sex);//执行到该语句直接跳过,求教原因!!!!
printf("\n请输入出生日期(yyyy/mm/dd):");
scanf("%4d/%2d/%2d",&emp1.birthday.year,&emp1.birthday.month,&emp1.birthday.day);
printf("\n输出员工信息");
printf("姓名:%s\n",emp1.name);
printf("住址:%s\n",emp1.addr);
printf("性别:%s\n",(emp1.sex==1)?"男":"女");
printf("%4d/%02d/%02d\n",emp1.birthday.year,emp1.birthday.month,emp1.birthday.day);
system("pause");
return 0;
}