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 s at 2005-03-20 16:56:09
#include<iostream.h>
void main()
{
	char a[10];
	int b[10],c,d,i;
	cin.getline(a,10);
	for(i=0;i<10;i++)
	{
			if(a[i]=='?')
			{
			b[i]=a[i]-'?';
			d=i;
			}
	else if (a[i]<='9'&&a[i]>='0')b[i]=a[i]-'0';
		else if(a[i]='x'&&i==9)b[i]=a[i]-'10';
	}
	for(i=0;i<=10;i++)
	{
		b[d]+=i;
		c=10*b[0]+9*b[1]+8*b[2]+7*b[3]+6*b[4]+5*b[5]+4*b[6]+3*b[7]+2*b[8]+b[9];
		if(c%11==0)
		{	
		if(d==9&&b[d]==10)
			{
				cout<<'x'<<endl;break;
			}
		else if(b[d]<9)
				{
					cout<<i<<endl;
				break;
				}
				//else (d!=9&&b[d]==10)
				//{
				//cout<<"a valid ISBN"<<endl;break;
				//}
				
		}
	b[d]-=i;
	}

}

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