Created
October 26, 2011 08:42
-
-
Save wwhhjj/1315802 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
main() | |
{ | |
float a,r1,r2,m; | |
char b,c; | |
printf("请输入加油量,汽油类型(a,b,c)以及服务类型(f,m,e)\n"); | |
printf("***************************************************\n"); | |
printf("请输入:"); | |
scanf("%f,%c,%c",&a,&b,&c); | |
switch(b) | |
{ | |
case 'a':r1=1.05; break; | |
case 'b':r1=1.35; break; | |
case 'c':r1=1.18; break; | |
} | |
switch(c) | |
{ | |
case 'f':r2=1; break; | |
case 'm':r2=0.95; break; | |
case 'e':r2=0.9; break; | |
} | |
m=a*r1*r2; | |
printf("应付款:"); | |
printf("%.1f\n",m); | |
printf("元\n"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment