c++新手,部分有bug请发评论

/*=========================================*SJ出品*=========================================*/ 
#include<bits/stdc++.h>			//万能头文件
#include<cstdlib>				//system("cls");=清屏  std::system("pause");=按任意键继续...		 																		
#include<unistd.h>  			//sleep(x);=等待x秒
#include<conio.h>				//b=getch();=不按回车输入b 
#include<windows.h>
#include <random>
#include <fstream>
using namespace std;
// 生成6位随机数(100000-999999)
int generateRandomNumber(int min, int max) {
    static random_device rd;
    static mt19937 gen(rd());
    uniform_int_distribution<int> dis(min, max);
    return dis(gen);
}
int sjs() {
    return generateRandomNumber(100000, 999999);
}
// 生成6位随机数(100000-999999)
/*
system ("color "):
    0 = 黑色       8 = 灰色
    1 = 蓝色       9 = 淡蓝色
    2 = 绿色       A = 淡绿色
    3 = 浅绿色     B = 淡浅绿色
    4 = 红色       C = 淡红色
    5 = 紫色       D = 淡紫色
    6 = 黄色       E = 淡黄色
    7 = 白色       F = 亮白色
*/
/*=========================================*SJ出品*=========================================*/ 
struct cj{
	short c=0;
	short c1=0;
	short c2=0;
	short c3=0;
	short c4=0;
	short c5=0;
	short c6=0;
	short c7=0;
	short c8=0;
};
struct yhxx{
	string name;
	short t;
	cj cj;
}p1;
void jiej(){
	system("cls"); 
	sleep(2);
	cout<<"制作人:朱博文(SJ集团)"<<endl<<"内容:徐译皓"<<endl<<"特别鸣谢:赵楷诚,夏晨轩,为开发提供灵感";
	sleep(4);
	cout<<endl<<"谢谢游玩。"; 
	sleep(2);
	cout<<endl<<"尽情期待逃离学校2!";
	sleep(2);
}
	short lj=0;
void HideCursor(){
    CONSOLE_CURSOR_INFO cursor_info = {1, 0}; 
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
	}
int main(){
	p1.t=0;
    HideCursor();
	cout<<"输入你的名字"<<endl;
	getline(cin,p1.name);
	L2:
	system("cls");
	system ("color 4");
	cout<<endl<<endl;
	cout<<"         ==========="<<endl;
	cout<<"        |逃离学校1  |"<<endl;
	cout<<"         ==========="<<endl;
	system ("color F");
	cout<<"	版本:1.0.5.5"<<endl<<"2025/12/24~2026/2/1"<<endl<<endl;
	cout<<"	输入a开始"<<endl;
	cout<<"	输入b查看成就"<<endl;
	cout<<"	输入c查看规则"<<endl;
	cout<<"	输入d退出"<<endl;
	cout<<"________________________"<<endl<<"	";
	char al;
	al=getch();
	system("cls");
	if(al=='a'){
		system ("color F");
			cout<<"SJ出品"<<endl;
			sleep(1);
			cout<<"主编许译皓"<<endl;
			sleep(1);
			cout<<"改编朱博文"<<endl;
			sleep(3);
			std::system("pause");
		system("cls"); 
		a1:
		cout<<"你醒了,你在厕所,";
		L1:
		cout<<"你要1、滋同学2、进浴室"<<endl;
		char b;
		b=getch();
		switch (b){
			case '1':
				cout<<"<"<<p1.name<<"> 击杀了 <同学>"<<endl;
				p1.cj.c++;
				if(p1.cj.c==3){
					sleep(1);
					cout<<"成就!尿尿大王1!"<<endl;
					sleep(3);
					std::system("pause");
					system("cls");
					goto L1; 
					break;
				}
				else{
				sleep(2);
				system("cls");
				goto L1; 
				break;
				}
			case '2':
				system("cls");
				cout<<"你看见了一个人全身都是血,你要1、尖叫2、告老师"<<endl; 
				b=getch();
				switch(b){
					case '1':
						system("cls");
						cout<<"你死了"<<endl;
						system ("color 4F");
						sleep(3);
						system ("color 0F");
							system("cls");
							cout<<"广告:"<<endl;
							sleep(1);
							cout<<"A:1+1=几?"<<endl;
							sleep(2);
							cout<<"B:等于4"<<endl;
							sleep(2);
							cout<<"A:为什么?"<<endl; 
							sleep(2);
							cout<<"B:因为肉包子很好吃"<<endl; 
							p1.cj.c3++;
							p1.cj.c6++;
							p1.t++;
							sleep(2);
						std::system("pause");
						system("cls");
						goto L2;
						break;
					case '2':
						system("cls");
						L6:
						cout<<"老师让大家自杀,你要1、割腕2、跳楼3、打晕自己"<<endl;
							b=getch();
							switch(b){
								case '1':
								case '2':
								case '3':
									cout<<"你晕了"<<endl;
									sleep(2); 
									system("cls");
									cout<<"你醒了,";
									L3: 
									cout<<"你要1、撒了旁边的老师2、出教室3、滋老师"<<endl;                              
									b=getch();
									switch(b){
										case '1':{
											cout<<"<"<<p1.name<<"> 击杀了 <老师>"<<endl;
											p1.cj.c2++;
												if(p1.cj.c2==3){
												sleep(1);
												cout<<"成就!艾莎王子!"<<endl;
												sleep(3);
												std::system("pause");
												system("cls");
												goto L3;
												break;
												}
												else{
													sleep(2);
													system("cls");
													goto L3;
												} 
										}
										case '2':{
										
											system("cls");
											L4:
											cout<<"你要1、下楼2、去教室3、回教室"<<endl;/////////// 
												b=getch();
													system("cls");
												switch(b){
													case '1':{
														L7:
														cout<<"你看见了2个老师,窗外有一个上吊的人,你要1、下楼2、告诉老师有人上吊3、上楼"<<endl;/////////////////////////////////////////////////
														b=getch();
														switch(b){
															case '1':{
																system("cls");
																cout<<"你要到1、校门2、回去";
																b=getch();
																	switch(b){
																		case '1':{
																			system("cls");
																			cout<<"你感到后面有人,你要1、回头2、继续跑";
																			b=getch();
																			switch(b){////////////////////////////////////////////////////////////////////////////
																				case '1':{
																					aaa:
																					system("cls");
																					cout<<"你感到浑身一麻...";
																					sleep(2);
																					std::system("pause");
																					system("cls");
																					lj++;
																					goto a1;
																					break;
																				}
																				case '2':{
																					if(lj>=3){
																						system("cls");
																						cout<<"你从梦中醒来,发现在上课,你想:“原来只是个梦...”"<<endl;
																						sleep(3);
																						cout<<"已通关"<<endl; 
																						sleep(2);
																						cout<<"成就!原来只是个梦...";
																						p1.cj.c8++;
																						sleep(3);
																						jiej();
																						goto L2;
																						break;
																					}
																					else{
																						goto aaa;
																					}
	
																				}
																		   }
																			break;
																		}
																		case '2':{
																			system("cls");
																			goto L7;
																			system("cls"); 
																			break;
																		}
																	} 
																break;
															}
															case '2':{
																goto L6;
																break;
															}
															case '3':{
																goto L4;
																break;
															}
														} 
														break;
													}
													case '2':{
														cout<<"有一个奇怪的玩偶你要1、碰他2、撕他3、出教室"<<endl;
														b=getch();
														system("cls");
														switch(b){
															case '1':{
																cout<<"你晕了"<<endl;
																sleep(2);
																system("cls");
																cout<<"你醒了,感觉四周似曾相识,";
																goto L4;
																break;
															} 
															case '2':{
																	system("cls");
																	cout<<"你死了"<<endl;
																	system ("color 4F");
																	sleep(3);
																	system ("color 0F");
																		system("cls");
																		cout<<"广告:"<<endl;
																		sleep(1);
																		cout<<"A:2+2=几?"<<endl;
																		sleep(2);
																		cout<<"B:等于6"<<endl;
																		sleep(2);
																		cout<<"A:为什么?"<<endl; 
																		sleep(2);
																		cout<<"B:因为菜包子很难吃"<<endl; 
																		p1.cj.c4++;
																		p1.cj.c6++;
																		p1.t++;
																		sleep(2);
																	std::system("pause");
																	
																	system("cls");
																	goto L2;
																break;
															}
															case '3':{
																goto L4;
																break;
															}
														}
														break;
													}
													case '3':{
														system("cls");
														cout<<"你出了教室,";
														goto L4;
														break;
													}
			
												} 
												
											break;
										} 
										case '3':{
											cout<<"<"<<p1.name<<"> 击杀了 <老师>"<<endl;
											p1.cj.c1++;
												if(p1.cj.c1==3){
													sleep(1);
													cout<<"成就!尿尿大王2!"<<endl;
													sleep(3);
													std::system("pause");
													system("cls");
													goto L3;
													break;
												}
												else{
												sleep(2);
												system("cls");
												goto L3;
												} 
											break;
										}
										
									}
							} 
				}
			default:{
				system("cls");
				a2:
				cout<<"要你叫!"<<endl;
				p1.cj.c7++;
				sleep(3);
				if(p1.cj.c7==5){
					sleep(1);
					cout<<"成就!要你叫!"<<endl;
					sleep(3);
					std::system("pause");
					system("cls");
					goto L2; 
				}
				goto L2;
			}

		}
	}
		else if(al=='b'){
			if(p1.cj.c>=3){
				cout<<"尿尿大王1"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(p1.cj.c1>=3){
				cout<<"尿尿大王2"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(p1.cj.c2>=3){
				cout<<"艾莎王子"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(p1.cj.c3>=3){
				cout<<"肉包子!"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			}
			if(p1.cj.c4>=3){
				cout<<"菜包子!"<<endl;
			} 
			else{
				cout<<"未解锁"<<endl;
			}
			if(p1.cj.c6>=5){
				cout<<"肉包子,菜包子!";
			}
			else{
				cout<<"未解锁"<<endl;
			}
			if(p1.cj.c7>=5){
				cout<<"要你叫!"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			if(p1.cj.c7!=0){
				cout<<"通关"<<endl;
			}
			else{
				cout<<"未解锁"<<endl;
			} 
			cout<<"死亡次数:"<<p1.t;
			cout<<endl<<endl<<endl<<endl;
			cout<<"输入任意返回"<<endl<<"________________________"<<endl;
			char d;
			d=getch();
			goto L2;
		}
	else if(al=='c'){
		cout<<"1、输入一个按Enter继续"<<endl<<"2、退出后不会保存"<<endl<<"3、不要乱输!!!"; 
		cout<<endl<<endl<<endl<<"输入任意退出"<<endl<<"________________________"<<endl;
		char d;
		d=getch();
			system("cls");
			goto L2;
	}
	else if(al=='d') {
		cout<<"确定?确定输入1,否则输入其他"<<endl;
		int d;
		d=getch();
		if(d!=1){
			goto L2;
		} 
		else{
			ofstream outFile("example.txt");
			outFile << p1.name << std::endl;
			outFile << p1.t << std::endl;
			outFile << p1.cj.c << std::endl;
			outFile << p1.cj.c1 << std::endl;
			outFile << p1.cj.c2 << std::endl;
			outFile << p1.cj.c3 << std::endl;
			outFile << p1.cj.c4 << std::endl;
			outFile << p1.cj.c5 << std::endl;
			outFile << p1.cj.c6 << std::endl;
			outFile << p1.cj.c7 << std::endl;
			outFile << p1.cj.c8 << std::endl;
			return 0;
		}
	}
	else{
		cout<<"有病吧!";
		sleep(5);
		goto L2;
	}
}	
/*=========================================*SJ出品*=========================================*/ 

0 comments

No comments so far...