#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int meal,dollar,num,anser,keepon;
anser=0;
printf("歡迎光臨!請問要點幾號餐?");
while(1)
{
meal=0;
dollar=0;
scanf("%d",&meal);
if(meal==1)
{
printf("您點的是一號!新台幣一百元\n");
dollar=100;
}
else if(meal==2)
{
printf("您點的是二號!新台幣一百二十元\n");
dollar=120;
}
else
{
printf("我們不提供%d號,請重新輸入:\n",meal);
continue;
}
num=0;
printf("您要幾份套餐?");
scanf("%d",&num);
anser+=dollar*num;
keepon=0;
printf("是否還要續點(Yes=1,No=2)?");
scanf("%d",&keepon);
if(keepon==1)
{
printf("請問您要續點幾號餐?");
continue;
}
else
{
break;
}
}
printf("總共是%d元",anser);
return 0;
}
沒有留言:
張貼留言