求助,只有10分
查看原帖
求助,只有10分
519924
gzgdh5545楼主2023/3/8 11:19
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main(){
	int n;
	string s1[100], s2[100];//定义字符串数组
	cin >> n;
	for (int i = 0; i < n; i++)cin >> s1[i] >> s2[i];//输入字符串
	for (int i = 0; i < n; i++) {//判断
		if (s1[i] == s2[i])
			cout << "Tie" << endl;
		else {
			if (s1[i] == "Rock" && s2[i] == "Scissors") {
				cout << "Player1" << endl;
				continue;
			}
			if (s1[i] == "Scissors" && s2[i] == "paper") {
				cout << "Player1" << endl;
				continue;
			}
			if (s1[i] == "Paper" && s2[i] == "Rock") {
				cout << "Player1" << endl;
				continue;
			}
			if (s2[i] == "Rock" && s1[i] == "Scissors") {
				cout << "Player2" << endl;
				continue;
			}
			if (s2[i] == "Scissors" && s1[i] == "paper") {
				cout << "Player2" << endl;
				continue;
			}	
			if (s2[i] == "Paper" && s1[i] == "Rock") {
				cout << "Player2" << endl;
				continue;
			}

		}
	}
	
	return 0;
}
2023/3/8 11:19
加载中...