| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:这是我的代码,哪里有问题,谢谢?In Reply To:这是我的代码,哪里有问题,谢谢? Posted by:EndlessHorizon at 2005-03-15 17:41:43 #include <string>
#include <stdio.h>
void main(){
char city[100];
char code;
int m;
float dis;
while(1){
m=0;
while(1){
scanf("%s",&city);
if(strcmp(city,"0")==0||strcmp(city,"#")==0)break;
scanf("%s",&city);
scanf("%f",&dis);
scanf("%c",&code);
scanf("%c",&code);
switch(code){
case 'F':
m+=int(dis*2);
break;
case 'B':
m+=int(dis*1.5+0.5);
break;
case 'Y':
dis=dis>500?dis:500;
m+=dis;
break;
}
}
printf("%d\n",m);
if(strcmp(city,"#")==0)
break;
else continue;
}
}
> }
> }
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator