跳到正文

休闲·娱乐

赌博机1

zhu_ge_chou_chou约 5 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 5 分钟

版本

  1. v2当前
  2. v1
C++
#include<bits/stdc++.h>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;/*
void filein(){
    FILE* fp=fopen("","r");
    **=fscanf(fp,"% ",&**);
}
void fileout(){
    FILE* fp=fopen("","w");
    fprintf(fp,"% ",&**);
}*/
void slowsay(string s,int spee){
	int ss=s.size();
	for(int i=0;i<=ss-1;i++){
		cout<<s[i];
		Sleep(spee);
	}
}
void color(int a)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
/*	1	深蓝色
	2	深绿色
	3	深青色
	4	深红色
	5	深粉色
	i	黄色
	7	深白色
	8	灰色
	9	浅蓝色
	10	浅绿色
	11	浅青色
	12	浅红色
	13	浅粉色
	14	浅黄色
	15	浅白色
	背景
	1~15		黑色
	16~31		深蓝色
	32~47		深绿色
	48~63		深青色
	64~79		深红色
	'S'~95		深粉色
	96~111		深黄色
	112~127 	深白色
	128~143 	灰色
	144~159 	浅蓝色
	160~1'A' 	浅绿色
	176~191 	浅青色
	192~207 	浅红色
	208~223 	浅粉色
	224~239 	浅黄色
	240~255 	浅白色
*/
}
char m[15][15]={
"",
" ---- ---- ",
"|         |",
"|    .    |",
"|         |",
"|   . .   |",
"|         |",
"|  . . .  |",
"|         |",
"| . . . . |",
"| | | | | |",
"| | | | | |",
"| | | | | |",
"| | | | | |",
" --------- ",
};
int n[5];
int ans=5;
void f(){
	int x=1,y=5;
	while(1){
		cout<<ans<<endl;
		for(int i=1;i<=14;i++){
			for(int j=0;j<=10;j++){
				if(i==x&&j==y){
					cout<<"o";
				}
				else{
					cout<<m[i][j];
				}
			}
			cout<<endl;
		}
		x++;
		if(m[x][y]>='0'&&m[x][y]<='9'){
			break;
		}
		if(m[x][y]!=' '){
			int ch=rand()%2;
			if(ch){
				y--;
			}
			else{
				y++;
			}
		}
		Sleep(50);
		system("cls");
	}
	ans+=int(m[x][y]-48);
	if(int(m[x][y]-48)==0){
		ans--;
	}
	return ;
}
int yj(){
	int cs=0;
	while(ans>0){
		memset(n,0,sizeof(n));
		for(int i=1;i<=5;i++){
			m[13][2*i-1]='0';
		}
		for(int i=1;i<=2;i++){
			int a=rand()%5;
			while(n[a]==1){
				a=rand()%5;
			}
			n[a]=1;
			m[13][2*a+1]=3+rand()%2+'0';
		}
		int a=rand()%20;
		if(a==0){
			int b=rand()%5;
			while(n[b]==1){
				b=rand()%5;
			}
			n[b]=1;
			m[13][2*b+1]=9+'0';
		}
		cout<<ans<<endl;
		for(int i=1;i<=14;i++){
			for(int j=0;j<=10;j++){
				cout<<m[i][j];
			}
			cout<<endl;
		}
		while(!kbhit()){

		}
		ans--;
		cs++;
		f();
	}
	return cs;
}
int main(){
	srand(time(0));
	while(1){
		int jc=yj();
		slowsay("你失败了",50);
		cout<<endl;
		slowsay("你的钱还是被压榨光了,该",50);
		cout<<endl;
		slowsay("你共玩了",50);
		cout<<jc<<"次";
		cout<<endl;
		slowsay("要继续吗",50);
		cout<<endl;
		slowsay("y,n",50);
		while(!kbhit()){

		}
		char a=getch();
		a=getch();
		if(a=='y'){
			system("cls");
			ans=5;
			continue;
		}
		else{
			system("cls");
			return 0;
		}
	}
	return 0;
}
原文