| ||||||||||
| 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 | |||||||||
帮我看一下哪儿错了?#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int king(int a,int b);
int queen(int a,int b);
void main()
{
char str1[2],str2[2];
int times,a,b;
cout<<"how many times you want to try?";
cin>>times;
for(int i=0;i<times;i++)
{
cout<<endl<<"please key in the location from start to the end:"<<endl;
cin>>str1;
cin>>str2;
a=fabs(str1[0]-str2[0]);
b=fabs(str1[1]-str2[1]);
if((a==0)&&(b==0))
cout<<0<<" "<<0<<" "<<0<<" "<<0;
else
{
if(a>b)
cout<<a<<" ";
else
cout<<b<<" ";
if((a==b)||(a==0)||(b==0))
cout<<1<<" ";
else
cout<<2<<" ";
if((a==0)||(b==0))
cout<<1<<" ";
else
cout<<2<<" ";
if(a==b)
cout<<1;
else
if((a-b)%2==0)
cout<<2;
else
cout<<"Inf";
}
}
cout<<endl;
}
我已经提交3次,全部退回……郁闷啊……
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator