#include<stdio.h>
int AOverwhelmB(char*str_a,char*str_b)
{
int val_a,val_b;
switch(str_a[0])
{
case 'J':val_a=11;break;
case 'Q':val_a=12;break;
case 'K':val_a=13;break;
case 'A':val_a=14;break;
case '2':val_a=15;break;
case '1':val_a=10;break;
default:
val_a=atoi(str_a);
}
switch(str_b[0])
{
case 'J':val_b=11;break;
case 'Q':val_b=12;break;
case 'K':val_b=13;break;
case 'A':val_b=14;break;
case '2':val_b=15;break;
case '1':val_b=10;break;
default:
val_b=atoi(str_b);
}
if(val_a>val_b)
return 1;
else
if(val_a==val_b)
return 0;
else
return -1;
};
int main()
{
char A[3],B[3];
printf("输入A的牌:");scanf("%s",A);
printf("输入B的牌:");scanf("%s",B);
switch(AOverwhelmB(A,B))
{
case 1:printf("A win.");break;
case 0:printf("No winner.");break;
case -1:printf("B win.");break;
default:printf("Unknown error.");break;
}
return 0;
}