新手 大神门能不能看一下
#include <stdio.h>int main( )
{
int gender,age;
scanf("%c %d",&gender,&age);
double mancost,womancost,
child1,child2,
manold,womanold,
charge,charge1,charge2,charge3,charge4,charge5,charge6;
charge=0.15;
mancost=80;
womancost=70;
child1=mancost*0.08;
child2=womancost*0.07;
manold=mancost*0.09;
womanold=womanold*0.08;
charge1=mancost*charge;
charge2=womancost*charge;
charge3=child1*charge;
charge4=child2*charge;
charge5=manold*charge;
charge6=womanold*charge;
if(gender=='f'||gender=='F')
{
if(age<=18)
{
printf("您的总费用为:%f\n",child2-charge4);
}
else if(age>=70)
{
printf("您的总费用为:%f\n",womanold-charge6);
}
else
{
printf("您的总费用为:%f\n",womancost-charge2);
}
}
else if(gender=='m'||gender=='M')
{
if(age<18)
{
printf("您的总费用为:%f\n",child1-charge3);
}
else if(age>=70)
{
printf("您的总费用为:%f\n",manold-charge5);
}
else
{
printf("您的总费用为:%f\n",mancost-charge1);
}
}
else
{
printf("您输入的性别不合法,请重新输入。");
}
return 0;
}
没报错 但是不知道为什么就跳过前两个选择 不管怎么输都只显示"您输入的性别不合法,请重新输入。"