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:hmh0512 at 2010-07-26 17:40:46 > #include <iostream> > #include <string> > using namespace std; > class record > { > public: > string ori; > string des; > int m; > char code; > int caculate() > { > int sum; > switch(code) > { > case 'F': > sum=m*2; > break; > case 'B': > sum=m+(m+1)/2; > case 'Y': > if(m<=500) > sum=500; > else > sum=m; > break; > } > return sum; > } > }; > int main() > { > record r; > while(1) > { > int ans=0; > while(cin>>r.ori&&r.ori!="0") > { > if(r.ori=="#") > return 0; > cin>>r.des>>r.m>>r.code; > ans+=r.caculate(); > } > cout<<ans<<endl; > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator