/*
Name: 石头剪子布 (双人)
Copyright:
Author:
Date: 13-10-07 09:15
Description:
*/
#include <iostream>
#include <string>
using namespace std;
void insShow()
{
cout<<"1-石头 2-剪子 3-布"<<endl;
}
int player1()
{
int cho1=0;
cout<<"player1\nchoice:";
cout.flush();
while(1)
{
cin>>cho1;
if(cho1<0&&cho1>4)
{
cout<<"输入错误!"<<endl;
continue;
}
else
break;
}
return cho1;
}
int player2()
{
int cho2=0;
cout<<"player2\nchoice:";
cout.flush();
while(1)
{
cin>>cho2;
if(cho2<0&&cho2>4)
{
cout<<"输入错误!"<<endl;
continue;
}
else
break;
}
return cho2;
}
int reslut(int a,int b)
{
if(a==1&&b==2)
return 1;
else if(a==1&&b==3)
return 2;
else if(a==2&&b==1)
return 2;
else if(a==2&&b==3)
return 1;
else if(a==3&&b==1)
return 1;
else if(a==3&&b==2)
return 2;
}
int main()
{
int res=0;
int x=0,y=0;
insShow();
x=player1();
system("cls");
insShow();
y=player2();
res=reslut(x,y);
cout<<"winer:"<<res<<endl;
system("pause");
return 0;
}