该楼层疑似违规已被系统折叠隐藏此楼查看此楼
#include
#include
using namespace std;
int main()
{
int s;
srand(int(0));
int win = 0, lose = 0,draw = 0;
while (cout << "出招吧! 1 = 剪刀, 2 = 石头, 3 = 布: ", cin >> s)
{
int c = (rand() % 3) + 1;
if (s > c &&s!=0 && s<=3)
{
cout << "他出 " << c << ", 你出 " << s << endl;
cout << "你赢了!" << endl;
win++;
cout << endl;
}
else if (s != c && s != 0 && s <= 3)
{
switch (c)
{
case 1: cout << "他出 " << c << ", 你出 " << s << endl;
cout << "你输了!" << endl << endl;
lose++; break;
case 2: cout << "他出 " << c << ", 你出 " << s << endl;
cout << "你输了!" << endl << endl;
lose++; break;
case 3: cout << "他出 " << c << ", 你出 " << s << endl;
cout << "你输了!" << endl << endl;
lose++; break;
default: cout << "你是否超越了数字 1~3 的范围?" << endl;
}
}
else if (s == c)
{
cout << "他出 " << c << ", 你出 " << s << endl;
cout << "是和局!" << endl;
draw++;
cout << endl;
}
else
cout << "你是否超越了数字 1~3 的范围?" << endl << endl;
}
cout << "你总共赢了:" << win << ", 输了:" << lose <
system("pause");
return 0;
}