Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

谁能解释一下错在哪?

Posted by hmh0512 at 2010-07-26 17:40:46 on Problem 1326
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator