黑客小C小游戏(DEVC++)时不时会更新

更新内容:爆破战争更新保卫战和进攻战

游戏列表

糖豆人双人版

街头篮球

植物大战僵尸

爆破战争

狼人杀

井字棋

网上冲浪

欢乐斗地主

神庙逃亡

大家一起来找茬

4399滚动的天空

4399泡泡堂

4399生死狙击

硬汉狙击

赛车

赛车2

赛车3

热血传奇


糖豆人双人版

#include
#include 
#include 
#include 
int run_map[101][101];
int x=7;
int y=1;
int x2=7;
int y2=1;
int a=0;
int g=1;
//0空1地(黄)2杆子(红)3糖葫芦(粉红)
//蓝1P绿2P
using namespace std;
int x_what(int x) {
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int wl(){
	if(run_map[x+1][y]==0){
		x++;
	}
	if(run_map[x2+1][y2]==0){
		x2++;
	}
}
int open(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_BLUE);
	cout<<"					糖豆人双人版"<4&&i<9){
				run_map[i][j]=3;
			}
			else if(i==7&&j%3==0&&j%4!=0){
				run_map[i][j]=2;
			}
			else if(i==8&&j%4==0&&j!=20){
				run_map[i][j]=0;
			}
			else if(i==8&&j%4!=0){
				run_map[i][j]=1;
			}
		}
	}
} 
int out(){
	system("cls");
	for(int i=0;i<=11;i++){
		for(int j=0;j<=31;j++){
			if(i==0||i==11){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
				cout<<"+";
			}
			else if(j==0||j==31){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
				cout<<"+";
			}
			else if(run_map[i][j]==1){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_GREEN);
				cout<<"-";
			}
			else if(run_map[i][j]==2){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
				cout<<"o";
			}
			else if(run_map[i][j]==3){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_BLUE);
				cout<<"O";
			}
			else if(i==x&&j==y){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE);
				cout<<"0";
				if(x>=8){
					x=7;
					y=1;
				}
			}
			else if(i==x2&&j==y2){
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
				cout<<"0";
				if(x2>=8){
					x2=7;
					y2=1;
				}
			}
			else {
				cout<<" ";
			}
		}
		cout<=30){
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_BLUE);
			cout<<"1P胜利";
			Sleep(2000); 
			return 0;
		}
		if(y2>=30){
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED|FOREGROUND_BLUE);
			cout<<"2P胜利";
			Sleep(2000);
			return 0;
		}
		a++;
		wl();
		Sleep(100);
	}
}

街头篮球

//版本:1.15
#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
int round=0;
int f;
int c,b;
int jn=1;
int ls1;
int ls2;
int ball=1;
int x;
int y;
int fs;
int nm=0;
int fx=1;
int a=1;
int in=0;
int z=0;
char js='*';
using namespace std;
int g_map[5][10];
int mx;
int my;
int dx;
int dy;
char ms;
void read() {
	ifstream cd("存档.txt");
	cd>>c;
	cd>>b;
	cd.close();
}
void write() {
	ofstream cd("存档.txt");
	cd<dy&&dy<9) {
		dy++;

	}
	if(my0) {
		dy--;
	}
	if(mx+10) {
		dx-=2;
	}
	for(int i=0; i<5; i++) {
		for(int j=0; j<5; j++) {
			if(g_map[i][j]==9) {
				g_map[i][j]=0;
			}
		}
	}
	g_map[dx][dy]=9;
}
int play() {
	char ch;
	if(kbhit()) {
		ch=getch();
		if((ch=='w'||ch=='i')&&mx-3>0) {
			mx-=4;
		}
		if((ch=='e'||ch=='u')&&my<9-5) {
			if(jn==0) {
				my+=2;
				fx=1;
			}
			if(jn==1) {
				in=1;
			}
			if(jn==2) {
				my+=3;
				fx=1;
			}
			if(jn==4) {
				in=1;
			}
			if(jn==3) {
				my+=5;
				fx=1;
			}
		}
		if((ch=='a'||ch=='j')&&my>0) {
			my--;
			fx=-1;
		}
		if((ch=='d'||ch=='l')&&my<9) {
			my++;
			fx=1;
		}
		if(ch=='s'||ch=='k') {
			in=1;
		}
	}
	if(kbhit()) {
		ch=getch();
		if((ch=='w'||ch=='i')&&mx>2) {
			mx-=3;
		}
		if((ch=='e'||ch=='u')&&my<9-5) {
			if(jn==0) {
				my+=2;
				fx=1;
			}
			if(jn==1) {
				if(my>5) {
					in=1;
				}
			}
			if(jn==2) {
				my+=3;
				fx=1;
			}
			if(jn==4) {
				if(my>4) {
					in=1;
				}
			}
			if(jn==3) {
				my+=5;
				fx=1;
			}
		}
		if((ch=='a'||ch=='j')&&my>0) {
			my--;
			fx=-1;
		}
		if((ch=='d'||ch=='l')&&my<9) {
			my++;
			fx=1;
		}
		if(ch=='s'||ch=='k') {
			in=1;
		}
	}
	if(kbhit()) {
		ch=getch();
		if((ch=='w'||ch=='i')&&mx>2) {
			mx-=3;
		}
		if((ch=='e'||ch=='u')&&my<9-5) {
			if(jn==0) {
				my+=2;
				fx=1;
			}
			if(jn==1) {
				if(my>5) {
					in=1;
				}
			}
			if(jn==2) {
				my+=3;
				fx=1;
			}
			if(jn==4) {
				if(my>4) {
					in=1;
				}
			}
			if(jn==3) {
				my+=5;
				fx=1;
			}
		}
		if((ch=='a'||ch=='j')&&my>0) {
			my--;
			fx=-1;
		}
		if((ch=='d'||ch=='l')&&my<9) {
			my++;
			fx=1;
		}
		if(ch=='s'||ch=='k') {
			in=1;
		}
	}
	for(int i=0; i<5; i++) {
		for(int j=0; j<5; j++) {
			if(g_map[i][j]==6) {
				g_map[i][j]=0;
			}
		}
	}
	g_map[mx][my]=6;
	g_map[mx][my]=6;
}
int m() {
	while(true) {
		a++;
		system("cls");
		out();
		robot();
		play();
		Sleep(500);
		if(my==dy&&mx==dx) {
			system("cls");
			system("color F0");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	);
			cout<<"球被抢了,失败";
			Sleep(3000);
			system("cls");
			return 0;

		}
		if(in==1) {
			system("cls");
			system("color F0");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
			cout<<"上篮成功,胜利";
			fs++;
			ls2++;
			Sleep(3000);
			system("cls");
			return 0;
		}
		wl();
		wl2();
		f++;
	}
}
int m2() {
	for(round=1; round<4; round++) {
		in=0;
		g_map[3][0]=6;
		mx=3;
		my=0;
		g_map[3][5]=9;
		dx=3;
		dy=5;
		g_map[1][9]=1;
		while(true) {
			a++;
			system("cls");
			out3();
			play();
			robot();
			play();
			Sleep(500);
			if(my==dy&&mx==dx) {
				system("cls");
				system("color F0");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	);
				cout<<"球被抢了,失败";
				Sleep(3000);
				system("cls");
				fs-=10;
				break;
			}
			if(in==1) {
				system("cls");
				system("color F0");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
				cout<<"上篮成功,胜利";
				fs+=10;
				ls2++;
				Sleep(3000);
				break;
			}
			wl();
			wl2();
			f++;
		}
	}
}
int xl() {
	while(true) {
		a++;
		system("cls");
		out2();
		play();
		Sleep(500);
		if(in==1) {
			system("cls");
			system("color F0");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
			cout<<"上篮成功,胜利";
			ls2++;
			fs++;
			Sleep(3000);
			system("cls");
			return 0;
		}
		f++;
	}
}
int cs() {
	char c;
	system("cls");
	cout<<"1:普通.蓝色球"<6&&x<9) {
		cout<<"6:联动.青球[清凉之夏](网上冲浪)"<6&&x<9) {
		ball=5;
	}
	if(c=='7'&&x==8) {
		ball=6;
	}
	if((x==11||x==12||x==1)&&c=='6') {
		ball=7;
	}
	if(c=='5') {
		ball=8;
	}
	system("cls");
}
int cs2() {
	system("cls");
	char c;
	cout<<"1:普通.M[小华](疾跑)<效果:加速跑向篮筐>"<"<"<"<";
	}
	if(x==6) {
		cout<<"6:限时.8[科比](扣篮)<效果:冲至篮筐下并扣篮>";
	}
	while(true) {
		if(kbhit()) {
			c=getch();
			break;
		}
	}
	if(c=='1') {
		js='M';
		jn=0;
	}
	if(c=='2') {
		js='*';
		jn=1;
	}
	if(c=='3') {
		js='x';
		jn=2;
	}
	if(c=='4') {
		js='o';
		jn=0;
	}
	if(c=='6'&&x==8) {
		js='O';
		jn=3;
	}
	if(c=='6'&&x==6) {
		js='8';
		jn=4;
	}
	if(c=='5') {
		js='U';
		jn=4;
	}
	system("cls");
}
int first() {
	jn=4;
	system("color F0");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	cout<<"					街头篮球"<=10&&fs<30) {
			cout<<"普通球员"<=30&&fs<60) {
			cout<<"CBA大佬"<=60&&fs<90) {
			cout<<"NBA球员"<=90) {
			cout<<"NBA名人堂MVP";
		}
		cout<<"按g进入经典模式,按h进入训练模式,按f进入斗牛模式(排位),按b进入篮球商城(5分换一次),按p进入球员商城(5分换一次),按o退出"<=5) {
			cs();
			fs-=5;
		}
		if(ms=='p'&&fs>=5) {
			cs2();
			fs-=5;
		} else {
			system("cls");
		}
	}
}
int go_in() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	);
	cout<<"------------------------"<tm_year;
	x=1 + ltm->tm_mon;
	z=y-2022;
	z*=4;
	if(x<=3&&x>=1) {
		z+=4;
	}
	if(x<=6&&x>=4) {
		z+=3;
	}
	if(x<=9&&x>=7) {
		z+=1;
	}
	if(x<=12&&x>=10) {
		z+=2;
	}
	long long sfz;
	long long sfz2;
	cout<<"请输入身份证:";
	cin>>sfz;
	system("cls");
	sfz2=sfz%1000000000000/100000000;
	if((y-sfz2)<18&&(sys.wDayOfWeek<5||sys.wHour<8||sys.wHour>9)) {
		cout<<"由于你是未成年且没到游戏时间,所以退出。";
		return 0;
	}
	read();
	first();
	write();
	return 0;
}

植物大战僵尸

#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#include
#include
#include 
#include 
#include 
using namespace std;
int x,y;
int Boss=100;
int map1[5][9];
int map2[3][9];
int map3[9];
int kill;
int xrk;
int yg;
int out1() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	cout<<"1豌豆射手(100阳光)"<=100) {
			cin>>b;
			map3[b]=9;
			yg-=100;
		}
	}
}
int play2() {
	char c;
	int a,b;
	if(kbhit()) {
		c=getch();
		if(c=='1'&&yg>=100) {
			cin>>a>>b;
			map2[a][b]=9;
			yg-=100;
		}
		if(c=='2'&&yg>=50) {
			yg-=50;
			cin>>a>>b;
			map2[a][b]=7;
			xrk++;
		}
	}
}
int play3() {
	char c;
	int a,b;
	if(kbhit()) {
		c=getch();
		if(c=='1'&&yg>=100) {
			cin>>a>>b;
			map1[a][b]=9;
			yg-=100;
		}
		if(c=='2'&&yg>=50) {
			yg-=50;
			cin>>a>>b;
			map1[a][b]=7;
			xrk++;
		}
		if(c=='3'&&yg>=25){
			yg-=25;
			cin>>a>>b;
			map1[a][b]=4;
		}
	}
}
int main() {
	first();
	int play_num=0;
	int key=0;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	cout<<"一波攻势来袭!";
	Sleep(2000);
	while(key==0) {
		yg=200;
		kill=0;
		y=8;
		while(true) {
			system("cls");
			out1();
			play1();
			Z1();
			if(y==0) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
				cout<<"僵尸们吃掉了你的脑子!";
				Sleep(2000);
				break;
			}
			if(kill>=10){
				key=1;
				break;
			}
			yg+=25;
			yg+=xrk*25;
			Sleep(500);
		}
	}
	key=0; 
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	cout<<"一大波攻势!";
	Sleep(2000);
	while(key==0) {
		yg=200;
		kill=0;
		y=8;
		while(true) {
			system("cls");
			out2();
			play2();
			Z2();
			if(y==0) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
				cout<<"僵尸们吃掉了你的脑子!";
				Sleep(2000);
				break;
			}
			if(kill>=30){
				key=1;
				break;
			}
			yg+=25;
			yg+=xrk*25;
			Sleep(500);
		}
	}
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	cout<<"一大波僵尸来袭!";
	Sleep(2000);
	key=0;
	while(key==0) {
		yg=200;
		kill=0;
		y=8;
		while(true) {
			system("cls");
			out3();
			play3();
			Z3();
			if(y==0) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
				cout<<"僵尸们吃掉了你的脑子!";
				Sleep(2000);
				break;
			}
			if(kill>=50){
				key=1;
				break;
			}
			yg+=25;
			yg+=xrk*25;
			Sleep(500);
		}
	}
	key=0;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	cout<<"僵王博士的复仇!(这次是改造机甲,因为放僵尸基本没用,要自己上。)";
	Sleep(2000);
	while(Boss>0) {
		Boss=100;
		yg=200;
		kill=0;
		x=2;
		y=8;
		while(true) {
			system("cls");
			out4();
			play3();
			Z4();
			if(y==0) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
				cout<<"僵尸们吃掉了你的脑子!";
				Sleep(2000);
				break;
			}
			if(Boss<=0){
				key=1;
				break;
			}
			yg+=25;
			yg+=xrk*25;
			Sleep(500);
		}
	}
	key=0;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	cout<<"击退僵尸!";
	Sleep(2000);
	return 0;
}

爆破战争

#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#include
#include
#include 
#include 
#include 
HWND hMainWnd;  //主窗口句柄
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) //必要的,要背下来
using namespace std;
int ms;
int dhurt=5;
int bptd=1;
int boom_time;
int map_num;
int hurt;
int js;
int x,y;
int dx,dy;
int bx,by;
int bww=100;
int qfw=100;
char hero;
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int map_out(int x) {
	if(x==0) {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
		cout<<"*";
	} else if(x==1) {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN|FOREGROUND_RED);
		cout<<"*";
	} else {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY );
		cout<<"*";
	}
}
int open() {
	hero='+';
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED);
	cout<<"----------"<1) {
			x--;
		}
		if(c=='a'&&y>1) {
			y--;
		}
		if(c=='s'&&x<9) {
			x++;
		}
		if(c=='d'&&y<9) {
			y++;
		}
	}
	if (KEY_DOWN(MOUSE_EVENT)) {
		if(x==dx||y==dy) {
			bww-=hurt;
		}
	}
}
int play2() {
	char c;
	if(kbhit()) {
		c=getch();
		if(c=='w'&&x>1) {
			x--;
		}
		if(c=='a'&&y>1) {
			y--;
		}
		if(c=='s'&&x<9) {
			x++;
		}
		if(c=='d'&&y<9) {
			y++;
		}
		if(c=='e') {
			if(x==bx&&y==by) {
				qfw=0;
			}
		}
	}
	if (KEY_DOWN(MOUSE_EVENT)) {
		if(x==dx||y==dy) {
			qfw-=hurt;
		}
	}
}
int AI() {
	if(bww<=0||qfw<=0) {
		return 0;
	}
	if(qfw<=0||bww<=0) {
		return 0;
	}
	if(x>dx&&dx<9&&dy!=y) {
		dx++;
	}
	if(y>dy&&dy<9&&dx!=x) {
		dy++;
	}
	if(x1&&dy!=y) {
		dx--;
	}
	if(y1&&dx!=x) {
		dy--;
	}
	if(dy==y||dx==x) {
		if(js==2) {
			bww-=dhurt;
		}
		if(js==1) {
			qfw-=dhurt;
		}
	}
}
int qf() {
	while(true) {
		out1();
		play1();
		AI();
		boom_time--;
		if(bww<=0||boom_time<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
			cout<<"土匪胜利";
			Sleep(2000);
			system("cls");
			return 0;
		}
		if(qfw<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
			cout<<"警察胜利";
			Sleep(2000);
			system("cls");
			return 0;
		}
		Sleep(500);
	}
}
int bw() {
	while(true) {
		out2();
		play2();
		AI();
		boom_time--;
		if(bww<=0||boom_time<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
			cout<<"土匪胜利";
			Sleep(2000);
			system("cls");
			return 0;
		}
		if(qfw<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
			cout<<"警察胜利";
			Sleep(2000);
			system("cls");
			return 0;
		}
		Sleep(500);
	}
}
int story_bwz(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	system("cls");
	cout<<"?警官:有土匪的改造人正在进攻城市,警局已经沦陷,我是唯一幸存者。";
	Sleep(2000);
	system("cls");
	cout<<"?警官:你一定要消灭他!";
	Sleep(2000);
	system("cls");
	cout<<"?警官:小心点,他拿着枪";
	Sleep(2000);
	system("cls");
	cout<<"?警官:啊!";
	Sleep(2000);
	system("cls");
}
int story_jgz(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	system("cls");
	cout<<"土匪zero:改造士兵进攻计划失败了,你只能自己进攻了";
	Sleep(2000);
	system("cls");
	cout<<"土匪zero:城市里有一个拿狙击枪的可怕的警察,你要消灭他";
	Sleep(2000);
	system("cls");
	cout<<"土匪zero:开始行动!";
	Sleep(2000);
	system("cls");
}
int js_h() {
	char c;
	while(c!='z') {
		system("cls");
		cout<<"n换角色,z确定。"<

狼人杀

/*
	Name: 杀人游戏 
	Date: 18/07/22 15:12
	by_黑客小C 
	小C出品,必属精品! 
*/
//杀人游戏 
//版本:1.15  
#include
#include
#include
#include 
#include 
#include 
using namespace std;
int me;
int day=1;
int maxrand=3;
int die[10];
int MVP[10];
int mvp;
int play_num=3;
int ID_1=12359;
int ID_2=80435;
int ID_3=37259;
int new_player=0; 
void num_first(){
	day=0; 
	die[0]=1;
	die[1]=1;
	die[2]=1;
	die[3]=1;
	die[4]=1;
	die[5]=1;
	die[6]=2;
	die[7]=1;
	die[8]=1;
	die[9]=1;
	return ;
}
int x_what(int x) {//取随机数 (用于释放技能、抽角色) 
	srand((unsigned)time(NULL));
	return( rand() % x);
}
void day_over(){
	Sleep(2000);
	system("cls");
	system("color F0");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	cout<3"<4"<5"<6"<7"<8"<9"<10"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp2() {//投票 
	int a;
	cout<<"3->4"<5"<6"<7"<8"<9"<10"<1"<2"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp3() {//投票 
	int a;
	cout<<"4->5"<6"<7"<8"<9"<10"<1"<2"<3"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp4() {//投票 
	int a;
	cout<<"5->6"<7"<8"<9"<10"<1"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp5() {//投票 
	int a;
	cout<<"4->5"<7"<8"<9"<10"<1"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp6() {//投票 
	int a;
	cout<<"4->5"<6"<8"<9"<10"<1"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp7() {//投票 
	int a;
	cout<<"4->5"<6"<7"<9"<10"<1"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp8() {//投票 
	int a;
	cout<<"4->5"<6"<7"<8"<10"<1"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp9() {//平民3投票 
	int a;
	cout<<"4->5"<6"<7"<8"<9"<1"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
bool tp10() {//平民4投票 
	int a;
	cout<<"4->5"<6"<7"<8"<9"<10"<2"<3"<4"<";
	cin>>a;
	die[a-1]--;
	system("cls");
}
int pm() {//平民脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[0]>0) {
			tp1();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int nw() {//女巫脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<>Z;
		Z--;
		Sleep(2000);
		system("cls");
		cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
		Sleep(2000);
		if(x_what(10)==2||x_what(10)==5) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"有狼人被查出,他们被吓走了,平民胜利。";
			return 0;
		}
		system("cls");
		system("color F0");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		if(H!=Z) {
			die[H]--;
			cout<<"天亮了,"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[1]>0) {
			tp2();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int lr() {//狼人脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<>H;
		H--;
		Sleep(2000);
		system("cls");
		cout<<"狼人请闭眼,女巫请睁眼,请问你要救谁?";
		Z=x_what(7);
		Sleep(2000);
		system("cls");
		cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
		Sleep(2000); 
		if(x_what(10)==2||x_what(10)==5) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"有狼人被查出,他们被吓走了,平民胜利。";
			return 0;
		}
		system("cls");
		system("color F0");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		if(H!=Z) {
			die[H]--;
			cout<<"天亮了,"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[2]>0) {
			tp3();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int lr2() {//狼人脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<>H;
		H--;
		Sleep(2000);
		system("cls");
		cout<<"狼人请闭眼,女巫请睁眼,请问你要救谁?";
		Z=x_what(7);
		Sleep(2000);
		system("cls");
		cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
		Sleep(2000); 
		if(x_what(10)==2||x_what(10)==5) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"有狼人被查出,他们被吓走了,平民胜利。";
			return 0;
		}
		system("cls");
		system("color F0");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		if(H!=Z) {
			die[H]--;
			cout<<"天亮了,"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[5]>0) {
			tp6();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int yyj() {//预言家脚本 
	while(true) {
		int AC;
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<>AC;
		if(AC==3||AC==6) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"有狼人被查出,他们被吓走了,平民胜利。";
			return 0;
		}
		system("cls");
		system("color F0");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		if(H!=Z) {
			die[H]--;
			cout<<"天亮了,"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[3]>0) {
			tp4();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int sw() {//守卫脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		int WA;
		cout<<"day:"<>WA;
		die[WA-1]++;
		cout<<"天黑请闭眼,狼人请睁眼,请问你要杀谁?";
		H=x_what(10);
		H--;
		Sleep(2000);
		system("cls");
		cout<<"狼人请闭眼,女巫请睁眼,请问你要救谁?";
		Z=x_what(10);
		Sleep(2000);
		system("cls");
		cout<<"女巫请闭眼,预言家请睁眼,请问你要查谁?";
		Sleep(2000);
		if(x_what(10)==2||x_what(10)==5) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"有狼人被查出,他们被吓走了,平民胜利。";
			return 0;
		}
		system("cls");
		system("color F0");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		if(H!=Z) {
			die[H]--;
			cout<<"天亮了,"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[4]>0) {
			tp5();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int bc() {//白痴脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[6]>0) {
			tp7();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int pm2() {//平民脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[7]>0) {
			tp8();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int pm3() {//平民脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[8]>0) {
			tp9();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		//day_over();
		day++;
	}
}
int pm4() {//平民脚本 
	while(true) {
		system("color 0f");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"day:"<9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		if(die[9]>0) {
			tp10();
		}
		if((die[2]<=0&&die[5]<=0)||day>9) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"平民胜利";
			return 0;
		}
		if(die[1]<=0&&die[3]<=0||die[1]<=0&&die[4]<=0||die[4]<=0&&die[3]<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			cout<<"狼人胜利";
			return 0;
		}
		day_over();
		day++;
	}
}
int main() {//主干 
	//Sleep(5000);//劳资这里运行缓慢,以便客户掏钱优化 
	int in_id;
	char ch;
	char next_ch;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	open1();
	ch='x';
	cout<<"账号1:"<>in_id;
	if(in_id==ID_1||in_id==ID_2||in_id==ID_3||in_id==new_player){
		cout<<"登录成功。";
		Sleep(2000);
		system("cls");
	}
	else{
		cout<<"你没有账号";
		return 0;
	}
	while(ch!='o'){
	if(play_num==0){
		system("cls");
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"游戏时间结束,已强制退出";
		return 0;
	}
	open2();
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	cout<<"我准备好了(按任意键):";
	cin>>next_ch;
	system("cls");
	num_first(); 
	for(int i=0; i<5; i++) {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"随机分配角色中";
		Sleep(100);
		cout<<".";
		Sleep(100);
		cout<<".";
		Sleep(100);
		cout<<".";
		Sleep(100);
		system("cls");
		Sleep(100);
	}
	me=x_what(8);
	me++;
	system("cls");
	//角色判定代码 
	//me=1;
	//me=2;
	//me=3;
	//me=4;
	//me=5;
	//me=6;
	//me=7;
	//me=8;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	if(me==1) {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
		cout<<"你是1号"<>ch;
	system("cls");
	play_num--; 
	}
	return 0;
}

井字棋

/*
	Name: 黑客小C
	Date: 06/06/22 21:56
*/
//版本:1.17
#include
#include 
#include
using namespace std;
int qp[4][4];
void open() {
	std::system("color E4");
	cout<<"						井字棋"<>h;
	Sleep(1000);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	if(h=='d') {
		std::system("color E4");
		do {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			system("cls");
			std::system("color E4");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			out();
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
			if(lost()) {
					SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
				cout<<"你输了!"<>x>>y;
			if(qp[x][y]==0)
				qp[x][y]=1;
			else {
				cout<<"犯规罚停一轮!"<>x>>y;
			if(qp[x][y]==0)
				qp[x][y]=1;
			else {
				cout<<"犯规罚停一轮!"<

网上冲浪

#include
#include
#include 
#include  
#include
#include    
#include   
#include    
#include     
using namespace std;
int dx,dy;
int mx,my;
int sea[5][3];
int ms=0;
int maxms=0;
int healthy=3;
/*
000
000
080
*/
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int first(){
	char ch;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			sea[i][j]=0;
		}
	}
	sea[4][1]=8;
	mx=4;
	my=1;
	cout<<"					网上冲浪(无尽)"<0){
		out();
		play();
		s();
		Sleep(500);
		system("cls");
		ms+=50;
		if(dy==my&&dx==mx){
			healthy--;
		}
	}
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	); 
	cout<<"米数:"<1000){
		cout<<"1:玩家:"<

欢乐斗地主

#include
#define PLAYERCOUNT 3
#define CARDSCOUNT 54
#define CURRENTPLAYER 0
#define VALUECOUNT 17
#define ERROR -1
 
using namespace std;
const char toFigure[]="34567890JQKA 2YZ";
enum COLOR{  //花色显示ASCII: 3~6
    eHEART=3,//红桃
    eDIAMOND,//方片
    eCLUB,   //草花
    eSPADE   //黑桃
};
 
class Card;
class CardsType;
class CardGroup;
class Player;
class Landlords;
class LastCards;
bool makeChoice(string tip);
bool cmp(Card* a,Card* b);
 
class Card{
  public:
    char figure;
    COLOR color;
    int value;
    Card(char _figure,COLOR _color){
        figure=_figure;
        color=_color;
        value=calValue();
    }
    int calValue(){
        for(int i=0;toFigure[i];i++){
            if(toFigure[i]==figure){
                return i;
            }
        }
        return ERROR;
    }
    void print(){
        assert(value!=ERROR);
        if(figure=='Z'){
            cout<<"ZZ";
        }else if(figure=='Y'){
            cout<<"YY";
        }else{
            cout<typeId==other.typeId;
    }
    void init(char* _typeStr,int _typeId,int _cnt1,bool _isContinuous,int _cnt2){
        cnt1=_cnt1;
        isContinuous=_isContinuous;
        cnt2=_cnt2;
        typeStr=_typeStr;
        typeId=_typeId;
    }
};
 
class CardGroup{
  public:
    vector cards;
    CardsType type;
    void calType(){
        int i,n=cards.size();
        //init(typeStr,typeId,cnt1,isContinuous,cnt2)
        if(n==0){
            type.init("不出",14,0,0,0);
            return;
        }
        if(n==2&&cards[0]->value==15&&cards[1]->value==14){
            type.init("王炸",0,0,0,0);
            return;
        }
        //统计同点数牌有多少张
        int cntFlag[VALUECOUNT]={0};
        for(i=0;ivalue]++;
        }
        //统计点数最多和最少的牌
        int maxCnt=0,minCnt=4;
        for(i=0;icntFlag[i]){
               minCnt=cntFlag[i];
            }
        }
        if(n==4&&maxCnt==4){
            type.init("炸弹",1,4,0,0);
            return;
        }
        if(n==1){
            type.init("单牌",2,1,0,0);
            return;
        }
        if(n==2&&maxCnt==2){
            type.init("对子",3,2,0,0);
            return;
        }
        if(n==3&&maxCnt==3){
            type.init("三张 ",4,3,0,0);
            return;
        }
        if(n==4&&maxCnt==3){
            type.init("三带一",5,3,0,1);
            return;
        }
        if(n==5&&maxCnt==3&&minCnt==2){
            type.init("三带一对",6,3,0,2);
            return;
        }
        if(n==6&&maxCnt==4){
            type.init("四带二",7,4,0,1);
            return;
        }
        if(n==8&&maxCnt==4&&minCnt==2){
            type.init("四带二",8,4,0,2);
            return;
        }
        if(n>=5&&maxCnt==1&&cards[0]->value==cards[n-1]->value+n-1){
            type.init("顺子",9,1,1,0);
            return;
        }
        if(n>=6&&maxCnt==2&&minCnt==2&&cards[0]->value==cards[n-1]->value+n/2-1){
            type.init("连对",10,2,1,0);
            return;
        }
        int fjCnt;//统计连续且大于3三张的牌
        for(i=0;i=3;i++,fjCnt++);
        if(fjCnt>1){
            if(n==fjCnt*3)
                type.init("飞机",11,3,1,0);
            else if(n==fjCnt*4)
                type.init("飞机",12,3,1,1);
            else if(n==fjCnt*5&&minCnt==2)
                type.init("飞机",13,3,1,2);
        }
    }
    void init(string inputStr, vector &cardsHolded){
        this->cards.clear();
        //不出
        if(inputStr=="N"){
            this->calType();
            return;
        }
        int i,j;
        //输入合法性判断
        for(i=0;ifigure==inputStr[i]){
                    visitFlag[j]=1;
                    find=cardsHolded[j];
                    break;
                }
            }
            if(find){
                this->cards.push_back(find);
            }else{
                cout<cards.clear();
                return;
            }
        }//end for(i=0;iarrange();
    }
    void init(vector newCards){
        this->cards=newCards;
        this->arrange();
    }
    bool isCanBeat(CardGroup &cardGroup){
        if(cardGroup.type.typeStr=="王炸"){
            return false;
        }else if(this->type.typeStr=="王炸"){
            return true;
        }else if(cardGroup.type==this->type &&this->type.typeStr=="炸dan"){
            return value()>cardGroup.value();
        }else if(cardGroup.type.typeStr=="炸dan"){
            return false;
        }else if(this->type.typeStr=="炸dan"){
            return true;
        }else if(cardGroup.type==this->type &&this->cards.size()==cardGroup.cards.size()){
            return this->value()>cardGroup.value();
        }else{
            return false;
        }
    }
    int value(){
        //计算牌组权值
        int i;
        if(type.typeStr=="三带一"||type.typeStr=="三带一对"||type.typeStr=="飞机"){
            for(i=2;ivalue==cards[i-2]->value){
                    return cards[i]->value;
                }
            }
        }
        if(type.typeStr=="四带二"){
            for(i=3;ivalue==cards[i-3]->value){
                    return cards[i]->value;
                }
            }
        }
        return cards[0]->value;
    }
    void arrange(){
        //整理:排序、计算类型
        sort(this->cards.begin(),this->cards.end(),cmp);
        this->calType();
    }
};
class LastCards{
    static LastCards *lastCards;
  public:
    Player *player;
    CardGroup cardGroup;
    static LastCards* inst(){//单例模式
        if(lastCards==NULL){
            lastCards=new LastCards();
        }
        return lastCards;
    }
    vector findCanBeatFrom(vector &cardsHolded){
        //查找能打得过的牌
        int i,j,k,n=cardsHolded.size(),m=cardGroup.cards.size();
        string typeStr=cardGroup.type.typeStr;
        vector ret;
        if(typeStr=="王炸"||nvalue]++;
        }
        int continuousCount=1;
        if(cardGroup.type.isContinuous){
            continuousCount=m/(cardGroup.type.cnt1+cardGroup.type.cnt2);
        }
        bool findFirstFigure;
        //cout<<"continuousCount="<value==firstFigure-j){
                        for(int kk=0;j>=0&&kk0){
                    int SecondFigures[5];
                    int SecondCount=continuousCount;
                    if(cardGroup.type.typeStr=="四带二")
                        SecondCount=2;
                    bool findSecondFigure=true;
                    for(j=0,k=-1;j=cardGroup.type.cnt2 &&cntFlag[k]value+3<value==SecondFigures[i]);
                                }else{
                                    j++;
                                }
                            }
                        }
                        return ret;
                    }//if(findSecondFigure)
                }//end if(cardGroup.type.cnt2>0)
                else{
                    return ret;
                }
            }//end if(findFirstFigure)
        }//end for(i=value+1;i=3;i--){
                if(cardsHolded[i]->value==cardsHolded[i-3]->value){
                    for(j=0;j<4;j++){
                        ret.push_back(cardsHolded[i-j]);
                    }
                    break;
                }
            }
        }
        return ret;  
    }//end vector findCanBeatFrom()
};
LastCards* LastCards::lastCards = NULL;
 
class Player{
  public:
    string name;
    vector cards;
    void arrange(){
        sort(cards.begin(),cards.end(),cmp);
    }
    void print(){
        cout<name<<":\t";
        for(int i=0;iprint();
        }
        cout<<"["< tip(){
        //提示功能,使自己最小一张连最长
        CardGroup ret;
        string temp;
        int j,k,m=cards.size();
        for(j=0;jfigure;
            }
            ret.init(temp,cards);
            if(ret.type.typeId!=ERROR){
                return ret.cards;
            }
        }
        ret.cards.clear();
        return ret.cards;
    }
    void chupai(CardGroup &cardGroup){
        //出牌
        cout<name<<":\t";
        cout<print();
            this->cards.erase(find(this->cards.begin(),this->cards.end(),cardGroup.cards[i]));
        }
        cout<<"\t["<cards.size()<<"]\n";
        if(cardGroup.type.typeStr!="不出"){
            //记录到 LastCards 中
            LastCards::inst()->player=this;
            LastCards::inst()->cardGroup.init(cardGroup.cards);
        }
    }
};
 
class Landlords{
    Player *player[PLAYERCOUNT];
    bool finished,youWin,landlordWin;
    int landlordIndex;
    Card *cards[CARDSCOUNT];
  public:
    Landlords(){
        int i,j,k;
        for(i=0;iplayer[i]=new Player();
        }
        //54张牌初始化
        for(k=i=0;i<14;i++){
            if(toFigure[i]==' '){
                continue;
            }
            for(COLOR color=eHEART;color<=eSPADE;color=(COLOR)(color+1)){
                this->cards[k++]=new Card(toFigure[i],color);
            }
        }
        this->cards[k++]=new Card('Y',eSPADE);
        this->cards[k]=new Card('Z',eHEART);
    }
    ~Landlords(){
        for(int i=0;iplayer[i];
        }
        for(int i=0;icards[i];
        }
    }
    void init(){
        player[CURRENTPLAYER]->name="Bice";
        player[1]->name="玩家2";
        player[2]->name="玩家3";
        finished=false;
        youWin=false;
        landlordWin=false;
        //抢地主
        landlordIndex=ERROR;
        while(landlordIndex==ERROR){
            srand((int)time(0));
            shuffle();
            landlordIndex=chooseLandlord();
        }
        cout<name<<"\t成为地主\n\n";
        this->add3Cards();
        LastCards::inst()->player=player[landlordIndex];
    }
    void startGame(){
        string inputSrt;
        CardGroup inputCards;
        for(int iTurns=landlordIndex;!finished;iTurns++){
            if(iTurns>=PLAYERCOUNT){
                iTurns=0;
            }
            if(iTurns==CURRENTPLAYER){
                cout<print();
                cout<<"输入提示:Z=大王 Y=小王 0=10 输入可无序 N=不出 例如:JKQ0A9\n请出牌:\t";
                do{
                    cin>>inputSrt;
                    inputCards.init(inputSrt,player[iTurns]->cards);
                }while(check(&inputCards)==false);
            }else{
                if(player[iTurns]==LastCards::inst()->player){
                    //若是上次出牌的是自己,启用提示功能
                    inputCards.init(player[iTurns]->tip());
                }else{
                    //查找能打得过上家的牌
                    inputCards.init(LastCards::inst()->findCanBeatFrom(player[iTurns]->cards));
                }
            }
            player[iTurns]->chupai(inputCards);//出牌
           
            if(player[iTurns]->cards.size()==0){
                //玩家手中没牌了,游戏结束
                finished=true;
                landlordWin=iTurns==landlordIndex;
                if(landlordWin){
                    youWin=landlordIndex==CURRENTPLAYER;
                }else{
                    youWin=landlordIndex!=CURRENTPLAYER;
                }
            }
        }
        cout<<"\n_________________________ "<<(youWin?"You Win!":"You Lose!")<<" _________________________\n\n";
    }
    void add3Cards(){
        cout<<"地主3张牌:\t";
        for(int i=PLAYERCOUNT*17;icards[i]->print();
            player[landlordIndex]->cards.push_back(cards[i]);
        }
        cout<arrange();
    }
    int chooseLandlord(){
        cout<<"\n_________________________ 抢地主 _________________________\n\n";
        int first=-1,last,cnt=0,i,j=rand()%PLAYERCOUNT;
        bool decision;
        for(i=0;iplayer[j]->name<<"\t抢地主\n";
            }else{
                cout<player[j]->name<<"\t没有抢\n";
            }
        }
        if(cnt==0){
            cout<<"没人抢,重新发牌\n";
            return ERROR;
        }
        if(cnt==1){
            //第一轮只有一人抢地主
            return first;
        }
        else{
            //最后一次争抢
            if(first==CURRENTPLAYER){
                decision=makeChoice("是否抢地主?(Y=抢/N=不抢):");
            }else{
                decision=rand()%2;
            }
            if(decision){
                cout<player[first]->name<<"\t抢地主\n";
                return first;
            }else{
                cout<player[first]->name<<"\t没有抢\n";
                return last;
            }
        }
    }
    void shuffle(){
        int i,j,k;    
        //洗牌
        for(i=0;icards[i],this->cards[rand()%CARDSCOUNT]);
        }
       
        //分牌
        for(k=i=0;iplayer[i]->cards.clear();
            for(j=0;j<17;j++){
                this->player[i]->cards.push_back(this->cards[k++]);
            }
            this->player[i]->arrange();//整理
            this->player[i]->print();
        }
    }
    bool check(CardGroup *cardGroup){
        if(cardGroup->type.typeId==ERROR){
            cout<<"出牌错误,重新输入\n";
            return false;
        }else if(cardGroup->type.typeStr=="不出"){
            return true;
        }else if(LastCards::inst()->player!=player[CURRENTPLAYER]&&!cardGroup->isCanBeat(LastCards::inst()->cardGroup)){
            cout<<"打不过,重新输入\n";
            return false;
        }else{
            return true;
        }
    }
};
 
int main(){
    Landlords *landlords=new Landlords();
    do{
        landlords->init();//发牌、抢地主
        landlords->startGame();//游戏开始
    }while(makeChoice("\n是否继续游戏?(Y=继续/N=结束): "));
    delete landlords;
    return 0;
}
 
bool makeChoice(string tip){
    cout<>input;
    return input=="Y"||input=="y";
}
 
bool cmp(Card* a,Card* b){
    //比较两张牌大小
    if(a->value==b->value){
        return a->color>b->color;
    }else{
        return a->value>b->value;
    }
}

神庙逃亡

#include
#include
#include 
#include  
#include
#include    
#include   
#include    
#include     
using namespace std;
int dx,dy;
int mx,my;
int sea[5][3];
int ms=0;
int maxms=0;
int healthy=3;
/*
000
000
080
*/
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int first(){
	char ch;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			sea[i][j]=0;
		}
	}
	sea[4][1]=8;
	mx=4;
	my=1;
	cout<<"					神庙逃亡(无尽)"<0){
		out();
		play();
		s();
		Sleep(500);
		system("cls");
		ms+=50;
		if(dy==my&&dx==mx){
			healthy--;
		}
	}
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	); 
	cout<<"米数:"<1000){
		cout<<"1:玩家:"<

大家一起来找茬

#include
#include
#include 
#include
#include
#include
#include
#include
#include 
using namespace std;
int ans1,ans2;
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int out(){
	ans1=x_what(9);
	ans2=ans1+1;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(i==ans1&&j==ans2){
				cout<<"o";
			}
			else{
				cout<<"0";
			}
		}
		cout<>a1>>a2;
		if(ans1==a1&&ans2==a2) {
			cout<<"答对了!"<

4399滚动的天空

#include
#include
#include 
#include
#include
#include
#include
#include
#include 
using namespace std;
int dx,dy;
int mx,my;
int sea[5][3];
int ms=0;
int maxms=0;
int healthy=3;
/*
000
000
080
*/
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int out() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED);
	cout<<"进度:"<0&&ms<100) {
			out();
			play();
			s();
			Sleep(500);
			system("cls");
			ms+=5;
			if(dy==my&&dx==mx) {
				healthy=0;
			}
		}
		if(ms==100) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED);
			cout<<"进度:"<0&&ms<100) {
			out2();
			play();
			s();
			Sleep(500);
			system("cls");
			ms+=5;
			if(dy==my&&dx==mx) {
				healthy=0;
			}
		}
		if(ms==100) {
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED);
			cout<<"进度:"<

4399泡泡堂

#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
using namespace std; //O炸弹,绿1P红2P,地图:5*5
int x1,y1,x2,y2;
int b1x=-2,b1y=-2;
int b2x=-2,b2y=-2;
int x,y,z;
int cn;
int open() {
	char c;
	cout<<"					4399泡泡堂(简化版)"<=1&&i<=3&&j>=1&&j<=3) {
				if(cn==1) {
					SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
					cout<<"*";
				} else if(cn==2){
					SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
					cout<<"*";
				}else if(cn==3){
					SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
					cout<<"*";
				}
			} else if(i==-1||i==5) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED| FOREGROUND_BLUE|FOREGROUND_GREEN);
				cout<<"*";
			} else if(j==-1||j==5) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED| FOREGROUND_BLUE|FOREGROUND_GREEN);
				cout<<"*";
			} else if(i==x1&&j==y1) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
				cout<<"*";
			} else if(i==x2&&j==y2) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
				cout<<"*";
			} else if(i==b1x&&j==b1y) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
				cout<<"O";
			} else if(i==b2x&&j==b2y) {
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
				cout<<"O";
			} else {
				cout<<" ";
			}
		}
		cout<4) {
		x1=4;
	}
	if(x2>4) {
		x2=4;
	}
	if(y1<0) {
		x1=0;
	}
	if(y2<0) {
		x2=0;
	}
	if(y1>4) {
		x1=4;
	}
	if(y2>4) {
		x2=4;
	}
}
int main() {
	char c;
	long long sfz;
	long long sfz2;
	cout<<"请输入身份证号:"<>sfz;
	SYSTEMTIME sys;
	GetLocalTime(&sys);
	time_t now=time(0);
	tm *gmtm = gmtime(&now);
	tm *ltm = localtime(&now);
	y=1900 + ltm->tm_year;
	x=1 + ltm->tm_mon;
	z=y-2022;
	z*=4;
	system("cls");
	sfz2=sfz%1000000000000/100000000;
	if((y-sfz2)<18&&(sys.wDayOfWeek<5||sys.wHour<8||sys.wHour>9)) {
		return 0;
	}
	char f;
	open();
	while(true) {
		if(cn==1) {
			cn=2;
		} else if(cn==2) {
			cn=3;
		}
		else{
			cn=1;
		}
		system("cls");
		b1x=-1;
		b1y=-2;
		b2x=-2;
		b2y=-2;
		if(f=='o') {
			break;
		}
		x1=0;
		y1=0;
		x2=4;
		y2=4;
		while(true) {
			out();
			play1();
			if((b1x==x2&&b1y==y2)||(b2x==x2&&b2y==y2)) {
				system("cls");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
				cout<<"1p胜利";
				Sleep(2000);
				break;
			}
			if((b2x==x1&&b2y==y1)||(b1x==x1&&b1y==y1)) {
				system("cls");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
				cout<<"2p胜利";
				Sleep(2000);
				break;
			}
			Sleep(200);
		}
		system("cls");
		cout<<"当前赛季:SSS"<

4399生死狙击

#include
#include
#include
#include
using namespace std;
int SIZ = 20;
HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord;
HANDLE hCon;
enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };
void SetColor(Color c) {
if(hCon == NULL)
    hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);
}
SYSTEMTIME sys;
//sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek
struct PLAYER {
int x,y;
int hp;
int gun;
int direct;
} p1,p2;
int map[1005][1005];
int abs(int x) {
if(x < 0) return -x;
return x;
}
void locate(int x,int y) {
coord.X=y - 1;
coord.Y=x - 1;
SetConsoleCursorPosition(hout,coord);
}
void print_map() {
locate(1,1);
SetColor(GRAY);
for(int i = 1; i <= SIZ; i++) cout<<"■";
locate(SIZ,1);
for(int i = 1; i <= SIZ; i++) cout<<"■";
for(int i = 2; i < SIZ; i++) {
    locate(i,1);
    cout<<"■";
    locate(i,SIZ*2-1);
    cout<<"■";
}
locate(SIZ+1,1);
SetColor(WHITE);
}
void create_tree(int x,int y) {
map[x][y] = map[x+1][y] = map[x-1][y] = map[x][y+1] = map[x][y-1] = 2;
}
void use_map(int x) {
if(x == 1) {
    SIZ = 20;
    SetColor(DARKGREEN);
    map[16][6]=map[15][6]=map[17][6]=map[16][7]=map[16][5]=map[14][13]=map[13][12]=map[13][13]=2;
    for(int i = 2; i < SIZ; i++) {
        for(int j = 2; j < SIZ; j++) {
            if(map[i][j] == 2) {
                locate(i,j*2-1);
                cout<<"■";
            }
        }
    }
    SetColor(GRAY);
    for(int i = 5; i <= 15; i++) {
        map[i][i] = 1;
        locate(i,i*2-1);
        cout<<"■";
    }
    SetColor(WHITE);
} else if(x == 2) {
    SIZ = 30;
    SetColor(GRAY);
    for(int i = 4; i <= 26; i++) {
        if(i == 13 || i == 14 ||i == 15) continue;
        map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
    }
    for(int i = 1; i <= SIZ; i++) {
        for(int j = 1; j <= SIZ; j++) {
            if(map[i][j] == 1) {
                locate(i,j*2-1);
                cout<<"■";
            }
        }
    }
    SetColor(DARKGREEN);
    for(int i = 10; i<=20; i++) {
        if(i == 13 || i == 17) continue;
        map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
    }
    create_tree(5,5);
    create_tree(18,18);
    for(int i = 1; i <= SIZ; i++) {
        for(int j = 1; j <= SIZ; j++) {
            if(map[i][j] == 2) {
                locate(i,j*2-1);
                cout<<"■";
            }
        }
    }
    SetColor(WHITE);
}
}
void cleanbody(int x,int y);
void putbody(int x,int y,int z);
void player_init() {
p1.hp = p2.hp = 300;
p1.gun = p2.gun = 1;
p1.direct = 4;
p2.direct = 2;
p1.x = 2;
p1.y = 2;
p2.x = SIZ - 1;
p2.y = SIZ - 1;
putbody(p1.x,p1.y,1);
putbody(p2.x,p2.y,2);
}
void mapinit() {
for(int i = 1; i <= SIZ; i++) {
    map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
}
}
void init() {
printf("Use Which Map?\n");
int x;
cin>>x;
system("cls");
use_map(x);
mapinit();
print_map();
player_init();
}
void putbody(int x,int y,int z) {
if(z == 1) SetColor(BLUE);
else if(z == 2) SetColor(RED);
locate(x,y*2-1);
cout<<"■";
SetColor(WHITE);
}
void cleanbody(int x,int y) {
locate(x,y*2-1);
cout<<" ";
}
/*
LIST
direct:
    w 1
    a 2
    s 3
    d 4
gun:
    usp 1
    mimigun 2
    awp 3
block:
    void 0
    stone 1
    tree 2
    player 3
    clip 4
*/
bool judge(int x,int y) {
if(map[x][y] == 1) return false;
if(map[x][y] == 2) return false;
if(map[x][y] == 3) return false;
return true;
}
bool judge_gun(int x,int y) {
if(map[x][y] == 1) return 0;
if(map[x][y] == 2) return 0;
if(map[x][y] == 3) {
    if(p1.x == x && p1.y == y) p1.hp -= 50;//此处暂时忽略威力
    else p2.hp -= 50;
    return 0;
}
return 1;
}
int cnt;
struct Clip {
int x,y;
int derect;
int force;
int start;
bool flag;
} clip[1000000];
void create_clip(int y,int x,int a,int b) {
int X,Y;
if(y == 1) {
    if(!judge_gun(a-1,b)) return;
    X = a-1;
    Y = b;
} else if(y == 2) {
    if(!judge_gun(a,b-1)) return;
    X = a;
    Y = b-1;
} else if(y == 3) {
    if(!judge_gun(a+1,b)) return;
    X = a+1;
    Y = b;
} else if(y == 4) {
    if(!judge_gun(a,b+1)) return;
    X = a;
    Y = b+1;
}
cnt++;
GetLocalTime( &sys );
clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
clip[cnt].x = X;
clip[cnt].y = Y;
if(x == 1) {
    clip[cnt].derect = p1.direct;
} else if(x == 2) {
    clip[cnt].derect = p2.direct;
}
}
void shoot(int x) {
if(x == 1) {
    create_clip(p1.direct,1,p1.x,p1.y);
} else if(x == 2) {
    create_clip(p2.direct,2,p2.x,p2.y);
}
}
void clean_clip(int x,int y) {
locate(x,y*2-1);
cout<<"  ";
locate(1,1);
}
void print_clip(int x,int y,int i) {
if(clip[i].flag) {
    clean_clip(x,y);
    return;
}
locate(x,y*2-1);
SetColor(YELLOW);
cout<<"''";
locate(1,1);
//  system("pause");
}
void clipmove() {
GetLocalTime( &sys );
int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
for(int i = 1; i <= cnt; i++) {
    if(clip[i].flag) continue;
    if(abs(clip[i].start - t) > 50) {
        clip[i].start = t;
        int x = clip[i].x;
        int y = clip[i].y;
        if(clip[i].derect==1) {
            if(!judge_gun(clip[i].x-1,clip[i].y)) {
                clip[i].flag = 1;
                clean_clip(x,y);
                continue;
            }
            clean_clip(clip[i].x,clip[i].y);
            clip[i].x--;
            print_clip(clip[i].x,clip[i].y,i);
        } else if(clip[i].derect==2) {
            if(!judge_gun(clip[i].x,clip[i].y-1)) {
                clip[i].flag = 1;
                clean_clip(x,y);
                continue;
            }
            clean_clip(clip[i].x,clip[i].y);
            clip[i].y--;
            print_clip(clip[i].x,clip[i].y,i);
        } else if(clip[i].derect==3) {
            if(!judge_gun(clip[i].x+1,clip[i].y)) {
                clip[i].flag = 1;
                clean_clip(x,y);
                continue;
            }
            clean_clip(clip[i].x,clip[i].y);
            clip[i].x++;
            print_clip(clip[i].x,clip[i].y,i);
        } else if(clip[i].derect==4) {
            if(!judge_gun(clip[i].x,clip[i].y+1)) {
                clip[i].flag = 1;
                clean_clip(x,y);
                continue;
            }
            clean_clip(clip[i].x,clip[i].y);
            clip[i].y++;
            print_clip(clip[i].x,clip[i].y,i);
        }
    }
}
}
void judge_hp() {
int x = p1.hp;
int y = p2.hp;
if(x<0 && y<0 && x > y) swap(x,y);
if(x <= 0) {
    locate(1,1);
    system("cls");
    printf("2P胜利!");
    Sleep(5000);
    //printf("\n-MADE BY Floatiy-");
    exit(0);
} else if(y <= 0) {
    locate(1,1);
    system("cls");
    printf("1P胜利!");
    Sleep(5000);
    //printf("\n-MADE BY Floatiy-");
    exit(0);
}
}
void prog() {
char ch;
while(true) {
    if(kbhit()) {
        ch=getch();
        if(ch == 'w' && judge(p1.x-1,p1.y)) {
            p1.direct = 1;
            cleanbody(p1.x,p1.y);
            map[p1.x][p1.y] = 0;
            putbody(--p1.x,p1.y,1);
            map[p1.x][p1.y] = 3;
        } else if(ch == '8' && judge(p2.x-1,p2.y)) {
            p2.direct = 1;
            cleanbody(p2.x,p2.y);
            map[p2.x][p2.y] = 0;
            putbody(--p2.x,p2.y,2);
            map[p2.x][p2.y] = 3;
        } else if(ch == 'a' && judge(p1.x,p1.y-1)) {
            p1.direct = 2;
            cleanbody(p1.x,p1.y);
            map[p1.x][p1.y] = 0;
            putbody(p1.x,--p1.y,1);
            map[p1.x][p1.y] = 3;
        } else if(ch == '4' && judge(p2.x,p2.y-1)) {
            p2.direct = 2;
            cleanbody(p2.x,p2.y);
            map[p2.x][p2.y] = 0;
            putbody(p2.x,--p2.y,2);
            map[p2.x][p2.y] = 3;
        } else if(ch == 's' && judge(p1.x+1,p1.y)) {
            p1.direct = 3;
            cleanbody(p1.x,p1.y);
            map[p1.x][p1.y] = 0;
            putbody(++p1.x,p1.y,1);
            map[p1.x][p1.y] = 3;
        } else if(ch == '5' && judge(p2.x+1,p2.y)) {
            p2.direct = 3;
            cleanbody(p2.x,p2.y);
            map[p2.x][p2.y] = 0;
            putbody(++p2.x,p2.y,2);
            map[p2.x][p2.y] = 3;
        } else if(ch == 'd' && judge(p1.x,p1.y+1)) {
            p1.direct = 4;
            cleanbody(p1.x,p1.y);
            map[p1.x][p1.y] = 0;
            putbody(p1.x,++p1.y,1);
            map[p1.x][p1.y] = 3;
        } else if(ch == '6' && judge(p2.x,p2.y+1)) {
            p2.direct = 4;
            cleanbody(p2.x,p2.y);
            map[p2.x][p2.y] = 0;
            putbody(p2.x,++p2.y,2);
            map[p2.x][p2.y] = 3;
        } else if(ch == '0') {
            shoot(2);
        } else if(ch == ' ') {
            shoot(1);
        }
        Sleep(20);
    }
    clipmove();
    judge_hp();
}
}
void welcome() {
printf("键位:\n玩家1 wasd控制移动,空格攻击,玩家2 数字小键盘4568控制移动,0攻击\n");
Sleep(2000);
}
int main() {
welcome();
GetLocalTime( &sys );
init();
prog();
return 0;
}

硬汉狙击

#include 
#include 
#include 
#include 
#include 
using namespace std;
/*=============== all the structures ===============*/
typedef struct Frame
{
COORD position[2];
int flag;
}Frame;
/*=============== all the functions ===============*/
void SetPos(COORD a)// set cursor
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos={i, j};
SetPos(pos);
}
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
//把第y行,[x1, x2) 之间的坐标填充为 ch
void drawRow(int y, int x1, int x2, char ch)
{
SetPos(x1,y);
for(int i = 0; i <= (x2-x1); i++)
cout<=frame.position[0].X)
if(spot.X<=frame.position[1].X)
if(spot.Y>=frame.position[0].Y)
if(spot.Y<=frame.position[0].Y)
return true;
return false;
}
void printCoord(COORD a)
{
cout <<"( "<>";
//drawFrame(45, 9, 79, 17, '=', '|');
while(1)
{ if( _kbhit() )
{
char x=_getch();
switch (x)
{
case 'w' :
{
if( j == 13)
{
SetPos(12, j);
cout<<" ";
j = 11;
SetPos(12, j);
cout<<">>";
SetPos(51, 13);
cout<<"            ";
SetPos(47, 11);
cout<<"简单的士兵:";
SetPos(51, 13);
cout<<"简单士兵有着较慢的移动速度。";
}
break;
}
case 's' :
{
if( j == 11 )
{
SetPos(12, j);
cout<<" ";
j = 13;
SetPos(12, j);
cout<<">>";
SetPos(51, 13);
cout<<"              ";
SetPos(47, 11);
cout<<"冷酷的士兵:";
SetPos(51, 13);
cout<<"冷酷的士兵移动速度较快。";
}
break;
}
case 'k' :
{
if (j == 8) return 1;
else return 2;
}
}
}
}
}
/*
DWORD WINAPI MusicFun(LPVOID lpParamte)
{
//DWORD OBJ;
sndPlaySound(TEXT("bgm.wav"), SND_FILENAME|SND_ASYNC);
return 0;
}
*/
/*================== the Game Class ==================*/
class Game
{
public:
COORD position[10];
COORD bullet[10];
Frame enemy[8];
int score;
int rank;
int rankf;
string title;
int flag_rank;
Game ();
//初始化所有
void initPlane();
void initBullet();
void initEnemy();
//初始化其中一个
//void initThisBullet( COORD );
//void initThisEnemy( Frame );
void planeMove(char);
void bulletMove();
void enemyMove();
//填充所有
void drawPlane();
void drawPlaneToNull();
void drawBullet();
void drawBulletToNull();
void drawEnemy();
void drawEnemyToNull();
//填充其中一个
void drawThisBulletToNull( COORD );
void drawThisEnemyToNull( Frame );
void Pause();
void Playing();
void judgePlane();
void judgeEnemy();
void Shoot();
void GameOver();
void printScore();
};
Game::Game()
{
initPlane();
initBullet();
initEnemy();
score = 0;
rank = 25;
rankf = 0;
flag_rank = 0;
}
void Game::initPlane()
{
COORD centren={39, 22};
position[0].X=position[5].X=position[7].X=position[9].X=centren.X;
position[1].X=centren.X-2;
position[2].X=position[6].X=centren.X-1;
position[3].X=position[8].X=centren.X+1;
position[4].X=centren.X+2;
for(int i=0; i<=4; i++)
position[i].Y=centren.Y;
for(int i=6; i<=8; i++)
position[i].Y=centren.Y+1;
position[5].Y=centren.Y-1;
position[9].Y=centren.Y-2;
}
void Game::drawPlane()
{
for(int i=0; i<9; i++)
{
SetPos(position[i]);
if(i!=5)
cout<<"o";
else if(i==5)
cout<<"|";
}
}
void Game::drawPlaneToNull()
{
for(int i=0; i<9; i++)
{
SetPos(position[i]);
cout<<" ";
}
}
void Game::initBullet()
{
for(int i=0; i<10; i++)
bullet[i].Y = 30;
}
void Game::drawBullet()
{
for(int i=0; i<10; i++)
{
if( bullet[i].Y != 30)
{
SetPos(bullet[i]);
cout<<"|";
}
}
}
void Game::drawBulletToNull()
{
for(int i=0; i<10; i++)
if( bullet[i].Y != 30 )
{
COORD pos={bullet[i].X, bullet[i].Y+1};
SetPos(pos);
cout<<" ";
}
}
void Game::initEnemy()
{
COORD a={1, 1};
COORD b={45, 15};
for(int i=0; i<8; i++)
{
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
void Game::drawEnemy()
{
for(int i=0; i<8; i++)
drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|');
}
void Game::drawEnemyToNull()
{
for(int i=0; i<8; i++)
{
drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' ');
}
}
void Game::Pause()
{
SetPos(61,2);
cout<<" ";
SetPos(61,2);
cout<<"暂停中...";
char c=_getch();
while(c!='p')
c=_getch();
SetPos(61,2);
cout<<" ";
}
void Game::planeMove(char x)
{
if(x == 'a')
if(position[1].X != 1)
for(int i=0; i<=9; i++)
position[i].X -= 2;
if(x == 's')
if(position[7].Y != 23)
for(int i=0; i<=9; i++)
position[i].Y += 1;
if(x == 'd')
if(position[4].X != 47)
for(int i=0; i<=9; i++)
position[i].X += 2;
if(x == 'w')
if(position[5].Y != 3)
for(int i=0; i<=9; i++)
position[i].Y -= 1;
}
void Game::bulletMove()
{
for(int i=0; i<10; i++)
{
if( bullet[i].Y != 30)
{
bullet[i].Y -= 1;
if( bullet[i].Y == 1 )
{
COORD pos={bullet[i].X, bullet[i].Y+1};
drawThisBulletToNull( pos );
bullet[i].Y=30;
}
}
}
}
void Game::enemyMove()
{
for(int i=0; i<8; i++)
{
for(int j=0; j<2; j++)
enemy[i].position[j].Y++;
if(24 == enemy[i].position[1].Y)
{
COORD a={1, 1};
COORD b={45, 3};
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
}
void Game::judgePlane()
{
for(int i = 0; i < 8; i++)
for(int j=0; j<9; j++)
if(judgeCoordInFrame(enemy[i], position[j]))
{
SetPos(62, 1);
cout<<"中弹";
drawFrame(enemy[i], '+', '+');
Sleep(1000);
GameOver();
break;
}
}
void Game::drawThisBulletToNull( COORD c)
{
SetPos(c);
cout<<" ";
}
void Game::drawThisEnemyToNull( Frame f )
{
drawFrame(f, ' ', ' ');
}
void Game::judgeEnemy()
{
for(int i = 0; i < 8; i++)
for(int j = 0; j < 10; j++)
if( judgeCoordInFrame(enemy[i], bullet[j]) )
{
score += 5;
drawThisEnemyToNull( enemy[i] );
COORD a={1, 1};
COORD b={45, 3};
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
drawThisBulletToNull( bullet[j] );
bullet[j].Y = 30;
}
}
void Game::Shoot()
{
for(int i=0; i<10; i++)
if(bullet[i].Y == 30)
{
bullet[i].X = position[5].X;
bullet[i].Y = position[5].Y-1;
break;
}
}
void Game::printScore()
{
if(score == 120 && flag_rank == 0)
{
rank -= 3;
flag_rank = 1;
}
else if( score == 360 && flag_rank == 1)
{
rank -= 5;
flag_rank = 2;
}
else if( score == 480 && flag_rank == 2)
{
rank -= 5;
flag_rank = 3;
}
int x=rank/5;
SetPos(60, 6);
cout<= rank )
flag_enemy = 0;
/* 输出得分 */
printScore();
}
}
void Game::GameOver()
{
system("cls");
COORD p1={28,9};
COORD p2={53,15};
drawFrame(p1, p2, '=', '|');
SetPos(36,12);
string str="嘎子中弹了!";
for(int i=0; i

赛车

#include
#include
#include 
#include  
#include
#include    
#include   
#include    
#include     
using namespace std;
int dx,dy;
int mx,my;
int sea[5][3];
int ms=0;
int maxms=0;
int healthy=1;
int sd=500;
/*
000
000
080
*/
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int first(){
	char ch;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			sea[i][j]=0;
		}
	}
	sea[4][1]=8;
	mx=4;
	my=1;
	cout<<"++++"<0){
				my--;
			}
		}
		if(ch=='d'){
			if(my<2){
				my++;
			}
		}
	}
}
int s(){
	if(dx==4){
		dx=0;
		dy=x_what(3);
	}
	else{
		dx++;
	}
}
int main(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	first();
	ms=0;
	while(healthy>0){
		out();
		play();
		s();
		Sleep(500);
		system("cls");
		ms+=50;
		if(dy==my&&dx==mx){
			healthy--;
		}
	}
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	); 
	cout<

赛车2

#include
#include
#include 
#include  
#include
#include    
#include   
#include    
#include     
using namespace std;
int dx,dy;
int mx,my;
int sea[5][3];
int ms=0;
int maxms=0;
int healthy=1;
int sd=500;
/*
000
000
080
*/
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int first(){
	char ch;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			sea[i][j]=0;
		}
	}
	sea[4][1]=8;
	mx=4;
	my=1;
	cout<<"++++"<0){
				my--;
			}
		}
		if(ch=='d'){
			if(my<2){
				my++;
			}
		}
		if(ch=='k'||ch=='p'){
			sd=50;
		}
		if(ch=='o'||ch=='l'){
			sd=1000;
		}
		else{
			sd=500;
		}
	}
}
int s(){
	if(dx==4){
		dx=0;
		dy=x_what(3);
	}
	else{
		dx++;
	}
}
int main(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	first();
	ms=0;
	while(healthy>0){
		out();
		play();
		s();
		Sleep(sd);
		system("cls");
		ms+=50;
		if(dy==my&&dx==mx){
			healthy--;
		}
	}
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	); 
	cout<

赛车3

#include
#include
#include 
#include  
#include
#include    
#include   
#include    
#include      
using namespace std;
int pm=100;
int dx,dy;
int mx,my;
int sea[5][3];
int ms=0;
int maxms=0;
int healthy=1;
int sd=500;
/*
000
000
080
*/
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int first(){
	char ch;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			sea[i][j]=0;
		}
	}
	sea[4][1]=8;
	mx=4;
	my=1;
	cout<<"++++"<0){
				my--;
			}
		}
		if(ch=='d'){
			if(my<2){
				my++;
			}
		}
		if(ch=='k'||ch=='p'){
			sd=50;
			ms+=100;
		}
		if(ch=='o'||ch=='l'){
			sd=1000;
			ms+=10;
		}
		else{
			sd=500;
			ms+=50;
		}
	}
}
int s(){
	if(dx==4){
		dx=0;
		dy=x_what(3);
		pm--;
	}
	else{
		dx++;
	}
}
int main(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	first();
	ms=0;
	while(healthy>0){
		out();
		play();
		s();
		Sleep(sd);
		system("cls");
		if(dy==my&&dx==mx){
			healthy--;
		}
		if(pm==1){
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE	); 
			cout<<"胜利";
			Sleep(2000);
			return 0;
		}
	}
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED	); 
	cout<<"第"<

热血传奇

//1.04
#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#include
#include
#include 
#include 
#include 
using namespace std;
int blue=100;
int HP=0;
int hurt=0;
int x=10,y=1; 
int Boss_HP=2000;
int Boss_hurt=200;
int Boss_x=10,Boss_y=20;
int monsters_HP=200;
int monsters_hurt=20;
int monsters_x,monsters_y;
int wz[5];
int hj=0;
int fj=0;
int xx=0;
int bx,by;
int money=0;
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int sc(){
	system("cls");
	char cz;
	cout<<"金钱"<=200){
		money-=200;
		fj+=100;
		wz[0]++;
	}
	if(cz=='2'&&money>=100){
		money-=100;
		hj+=100;
		wz[1]++;
	}
	if(cz=='3'&&money>=100){
		money-=100;
		hurt+=100;
		wz[2]++;
	}
	if(cz=='4'&&money>=200){
		money-=200;
		xx+=100;
		wz[3]++;
	}
	if(cz=='5'&&money>=100){
		money-=100;
		HP+=500;
		wz[4]++;
	}
}
int open(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
	cout<<"			传奇(DEVC++阳光版)";
	cout<<"by:黑客小C"<=100){
				blue-=100;
				HP+=200;
			if(x==monsters_x&&y==monsters_y-1){
				monsters_HP-=(hurt*2);
				HP+=xx;
			}
			if(x==Boss_x&&y==Boss_y-1){
				Boss_HP-=(hurt*2);
				HP+=xx;
			}
			}
		}
		if(cz=='q'){
			sc();
		}
		if(cz==' '){
			wpl();
		}
	}
}
int zy(){
	int num;
	cout<<"1道士2法师3战士4刺客";
	cin>>num;
	if(num==1){
		HP=800;
		hurt=200;
	}
	else if(num==2){
		HP=200;
		hurt=1000;
	}
	else if(num==3){
		HP=1200;
		hurt=100;
	}
	else if(num==4){
		HP=500;
		hurt=900;
	}
	system("cls");
}
int main(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
	int f,b,i;
	char name[101];
	cout<<"请输入名字:"<16){
		cout<<"请输入真名";
		return 0;
	}
	long long sfz;
	long long sfz2;
	cout<<"请输入身份证号:"<>sfz;
	SYSTEMTIME sys;
	GetLocalTime(&sys);
	time_t now=time(0);
	tm *gmtm = gmtime(&now);
	tm *ltm = localtime(&now);
	f=1900 + ltm->tm_year;
	b=1 + ltm->tm_mon;
	i=y-2022;
	i*=4;
	system("cls");
	sfz2=sfz%1000000000000/100000000;
	if((f-sfz2)<18&&(sys.wDayOfWeek<5||sys.wHour<8||sys.wHour>9)) {
		cout<<"由于你是未成年且没到游戏时间,所以强制退出。";
		return 0;
	}
	zy(); 
	open();
	while(true){
		out();
		play();
		if(Boss_HP<=0){
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED| FOREGROUND_GREEN);
			cout<<"游戏胜利";
			Sleep(2000); 
			return 0;
		}
		if(HP<=0){
			system("cls");
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
			cout<<"你死了";
			Sleep(2000);
			return 0;
		}
		if(monsters_HP<=0){
			monsters_HP=200;
			money+=100;
			hurt+=100;
			monsters_x=x_what(18);
			monsters_x++;
			monsters_y=x+1;
		}
		if(x==monsters_x&&y==monsters_y-1){
			HP-=monsters_hurt;
			HP+=hj;
			monsters_HP-=fj;
		}
		if(x==Boss_x&&y==Boss_y-1){
			HP-=Boss_hurt;
			HP+=hj;
			Boss_HP-=fj;
		}
		blue+=10;
		Sleep(100);
	}
	return 0;
}

你可能感兴趣的:(小游戏网页主界面,c++)