#include<stdio.h>
int main()
{
double ipay=200; /*定义变量*/
int irenshu;
int imother;
int iswitch;
printf("请输入当前月份和:"); /*显示信息*/
scanf("%d",&imother);
printf("请输入购买人数:");
scanf("%d",&irenshu);
if(imother>=1&&imother<=6) /*判断*/
{
iswitch=1;
}
else if(imother>6&&imother<=9)
{
iswitch=2;
}
else if(imother>9&&imother<=12)
{
iswitch=3;
}
else
{
iswitch=4;
}
switch(iswitch)
{
case 1:
ipay=irenshu*(ipay*0.8);
break;
case 2:
ipay=irenshu*ipay;
break;
case 3:
ipay=irenshu*(ipay*0.5);
break;
case 4:
printf("您输入错误");
break;
default:
break;
}
printf("需要付的价钱为:%d\n",ipay);
return 0;
}
int main()
{
double ipay=200; /*定义变量*/
int irenshu;
int imother;
int iswitch;
printf("请输入当前月份和:"); /*显示信息*/
scanf("%d",&imother);
printf("请输入购买人数:");
scanf("%d",&irenshu);
if(imother>=1&&imother<=6) /*判断*/
{
iswitch=1;
}
else if(imother>6&&imother<=9)
{
iswitch=2;
}
else if(imother>9&&imother<=12)
{
iswitch=3;
}
else
{
iswitch=4;
}
switch(iswitch)
{
case 1:
ipay=irenshu*(ipay*0.8);
break;
case 2:
ipay=irenshu*ipay;
break;
case 3:
ipay=irenshu*(ipay*0.5);
break;
case 4:
printf("您输入错误");
break;
default:
break;
}
printf("需要付的价钱为:%d\n",ipay);
return 0;
}