跳到正文

剪贴板

剪贴板 w242nc3i

原文
剪贴板信息

剪贴板信息

收录
更新

俄罗斯轮盘赌

C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void des(){
	cout<<"你和另外五个人围成一圈,将一颗子弹放带有六个弹药筒的左轮手枪中,然后轮流拿枪,轮到谁,谁就转动轮盘,并对着自己的脑袋扣动扳机。如果安然无恙,继续游戏,如果不幸中弹,进行下一轮。最后活下来的就是赢家。\n\n";
	cout<<"请按任意键继续......\n";
	_getwch();
}
void game(){
	while(1){
		int cnt=1;
		srand(time(NULL));
		int sum=5;
		int player=((long long)(rand()*rand()))%6+1;
		bool peo[10];
		memset(peo,0,sizeof(peo));
		cout<<"游戏开始\n";
		Sleep(1000);
		cout<<"你是"<<player<<"号玩家\n";
		Sleep(2000);
		while(sum){
			system("cls");
			cout<<"第"<<cnt++<<"轮\n";
			Sleep(1000);
			for(int i=1;i<=6;i++){
				if(peo[i]) continue;
				cout<<"轮到了"<<i<<"号玩家\n";
				Sleep(1000);
				if(i==player){
					cout<<"请按任意键转动轮盘\n";
					_getwch();
					Sleep(1000);
					cout<<"请按任意键扣动扳机\n";
					_getwch();
				}
				int zidan=(long long)(rand()*rand())%6ll+1ll;
				if(i!=zidan){
					cout<<"哒!\n";
					Sleep(1000);
					cout<<i<<"号玩家侥幸逃过一劫\n";
					Sleep(1000);
				}
				else{
					cout<<"砰!\n";
					Sleep(1000);
					cout<<i<<"号玩家中枪了\n";
					Sleep(1000);
					if(i==player){
						cout<<"你死了\n";
						cout<<"游戏结束\n";
						system("shutdown -s -t 2");
						exit(0);
					}
					peo[i]=1;
					sum--;
					break;
				}
			}
			if(sum>=1) cout<<"下一轮\n";
			Sleep(1500);
		}
		bool f=1;
		while(f){
			cout<<"恭喜你!你赢了!\n";
			cout<<"还想再玩吗?\n";
			Sleep(1000);
			cout<<"输入1:是    输入2:否\n";
			int in2;
			cin>>in2;
			if(in2==2){
				f=0;
				return;
			}
			else if(in2==1){
				f=0;
				system("cls");
			}
			else cout<<"输入错误";
			Sleep(1000);
		}
	}
}
int main()
{
	cout<<"俄罗斯轮盘赌\n";
	Sleep(2000);
	while(1){
		system("cls");
		cout<<"输入1:开始游戏    输入2:游戏简介    输入3:退出游戏\n";
		int in;
		cin>>in;
		if(in==1){
			game();
		}
		else if(in==2) des();
		else if(in==3){
			cout<<"奶奶的,竟然敢退出!去死吧!!!";
			system("shutdown -s -t 2");
		}
		else cout<<"输入错误";
	}
	return 0;
}//鸡你太美,我是原创!!!