编写程序判断乒乓球比赛的结果:
#include <iostream>
using namespace std;
int main()
{int a,b;
cin>>a>>b;
if(a<0||b<0)cout<<"Illegal";
else if (a<10&&b<10)cout<<"In progress";
else if (a==11&&b<10)cout<<"A win";
else if (b==11&&a<10)cout<<"B win";
else if ((a==11&&b==10)||(b==11&&a==10))cout<<"In progress";
else if (a==10&&b==10)cout<<"In progress";
else if(a>=10&&b>=10)
{ int c=0;
c=a-b;
if(c==2)cout<<"A win";
else if (c==-2)cout<<"B win";
else if(c==-1||c==0||c==1)cout<<"In progress";
else cout<<"Illegal";
}
else if((a>11&&b<10)||(b>11&&a<10))
{
cout<<"Illegal";
}
return 0;
}