#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
float bj,blh;
scanf("%d%f",&n,&bj);
switch(n)
{
case (1):
blh=bj+bj*0.025*1;
printf("%f",blh);
break;
case (2):
blh=bj+bj*0.0243*2;
printf("%f",blh);
break;
case (3):
blh=bj+bj*0.0270*3;
printf("%f",blh);
break;
case (5):
blh=bj+bj*0.0288*5;
printf("%f",blh);
break;
case (8):
blh=bj+bj*0.0300*8;
printf("%f",blh);
break;
}
return 0;
}
心得体会
1在做这道题时 我写好了可就是有错误,不是case后忘记空一个
而是是在witch后 忘记加{} 检查了好久 最后看书才恍然大悟。
知识点
1学会运用switch语句