#include
int main()
{
char kind;
float sum = 0;
float k = 0;
int count = 0;
while(1)
{
printf("请输入车辆种类:A/B/C\n");
scanf("%c",&kind);
printf("请输入公里数:");
scanf("%f",&k);
switch(kind)
{
case 'A':
case 'a': sum = sum + k*0.5; count++; break;
case 'B':
case 'b': sum = sum + k*0.4; count++; break;
case 'C':
case 'c': sum = sum + k*0.3; count++; break;
}
if(count==50)
{
printf("满50辆车,共收费%f元。",sum);
break;
}
}
return 0;
}
很简单阿