连环判断
2025-08-09 08:52:10
发布于:江苏
0阅读
0回复
0点赞
玩过石头剪刀布的应该都会
连环判断即可
#include<bits/stdc++.h>
using namespace std;
string a[105],b[105];
int n;
int main()
{
cin >> n;
for(int i = 1;i <= n;i++)
{
cin >> a[i] >> b[i];
}
int sum;
for(int i = 1;i <= n;i++)
{
if((a[i] == "Rock" && b[i] == "Scissors") || (a[i] == "Paper" && b[i] == "Rock") || (a[i] == "Scissors" && b[i] == "Paper"))
{
cout << "Player1" << "\n";
}
else if((a[i] == "Scissors" && b[i] == "Rock") || (a[i] == "Rock" && b[i] == "Paper") || (a[i] == "Paper" && b[i] == "Scissors"))
{
cout << "Player2" << "\n";
}
else
{
cout << "Tie" << "\n";
}
}
return 0;
}
这里空空如也
有帮助,赞一个