题目描述
用switch语句实现多分支选择
样例
#include<cstdio>
using namespace std;
int main()
{
int x,y;
scanf("%d %d",&x,&y);
switch(x)
{
case 1:printf("Total: R$ %.2lf",y*4.00);break;
case 2:printf("Total: R$ %.2lf",y*4.50);break;
case 3:printf("Total: R$ %.2lf",y*5.00);break;
case 4:printf("Total: R$ %.2lf",y*2.00);break;
case 5:printf("Total: R$ %.2lf",y*1.50);break;
}
return 0;
}