小游戏(求赞)
2026-01-08 16:26:25
发布于:浙江
#include<iostream>
#include<string>
using namespace std;
struct s{//定义结构体,方便后面
string one;//第一局的
string two;//第二局的
string three;//第三局的
}a,b,c;//懂的都懂
int main(){
string x;//这个作用你自己猜
cin>>x;
cout<<"这是一个石头剪刀布小游戏,规则懂得都懂。。。"<<endl;
cout<<"可选择先出或者后出哦"<<endl;
if(x=="先出"){
cin>>a.one;//输入结构体
cin>>b.two;
cin>>c.three;
if(a.one=="石头" || b.two=="石头" || c.three=="石头"){//判断第一局
cout<<"我:石头"<<" "<<"机器人:布"<<endl;
}if(a.one=="剪刀" || b.two=="剪刀" || c.three=="剪刀"){//判断第二局
cout<<"我:剪刀"<<" "<<"机器人:石头"<<endl;
}if(a.one=="布" || b.two=="布" || c.three=="布"){//判断第三局
cout<<"我:布"<<" "<<"机器人:剪刀"<<endl;
}
cout<<endl;//输出结果
cout<<"第1局胜:机器人"<<endl;
cout<<"第2局胜:机器人"<<endl;
cout<<"第3局胜:机器人"<<endl;
}
if(x=="后出"){
cout<<"就你还想后出,吃我一击"<<endl;
return 0;
}
return 0;
}
全部评论 1
#include<iostream>
#include<string>
using namespace std;
struct s{//定义结构体,方便后面
string one;//第一局的
string two;//第二局的
string three;//第三局的
}a,b,c;//懂的都懂
int main(){
string x;//这个作用你自己猜
cin>>x;
cout<<"这是一个石头剪刀布小游戏,规则懂得都懂。。。"<<endl;
cout<<"可选择先出或者后出哦"<<endl;
cout<<"你能赢我吃!"<<endl;
if(x=="先出"){
cin>>a.one;//输入结构体
cin>>b.two;
cin>>c.three;
if(a.one=="石头" || b.two=="石头" || c.three=="石头"){//判断第一局
cout<<"我:石头"<<" "<<"机器人:布"<<endl;
}if(a.one=="剪刀" || b.two=="剪刀" || c.three=="剪刀"){//判断第二局
cout<<"我:剪刀"<<" "<<"机器人:石头"<<endl;
}if(a.one=="布" || b.two=="布" || c.three=="布"){//判断第三局
cout<<"我:布"<<" "<<"机器人:剪刀"<<endl;
}
cout<<endl;//输出结果
cout<<"第1局胜:机器人"<<endl;
cout<<"第2局胜:机器人"<<endl;
cout<<"第3局胜:机器人"<<endl;
}
if(x=="后出"){
cout<<"就你还想后出,吃我一击"<<endl;
cout<<" **"<<endl;
cout<<" **"<<endl;
cout<<" *"<<endl;
cout<<" "<<endl;
cout<<" ** ***** ** "<<endl;
cout<<" ***** "<<endl;
cout<<" ***** "<<endl;
cout<<" ***** ***"<<endl;
cout<<" *********** "<<endl;
return 0;
}
return 0;
}昨天 来自 浙江
0








有帮助,赞一个