标签:des style blog http io color ar sp for
1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 int T; 6 double amount; 7 char unit[3]; 8 double total; 9 int time; 10 11 time=1; 12 13 scanf("%d",&T); 14 15 while(T--){ 16 scanf("%lf%s",&amount,unit); 17 18 printf("%d ",time); 19 time++; 20 21 if(strcmp(unit,"kg")==0){ 22 total=amount*2.2046; 23 24 printf("%.4lf lb\n",total); 25 26 } 27 28 else if(strcmp(unit,"lb")==0){ 29 total=amount*0.4536; 30 31 printf("%.4lf kg\n",total); 32 } 33 34 else if(strcmp(unit,"l")==0){ 35 total=amount*0.2642; 36 37 printf("%.4lf g\n",total); 38 } 39 40 else if(strcmp(unit,"g")==0){ 41 total=amount*3.7854; 42 43 printf("%.4lf l\n",total); 44 } 45 } 46 47 48 return 0; 49 }
标签:des style blog http io color ar sp for
原文地址:http://www.cnblogs.com/zqxLonely/p/4087029.html