自制C++小游戏走迷宫

直接上代码,有不足请指正,最新编辑于2025.3.22

#include
#include
#include
#include
using namespace std;
char a[100][100]={"####################",
				"#O#             ####",
				"#   ### ####### ####",
				"####### ######  ####",
				"##      ###### #####",
				"## ########### #####",
				"##              ####",
				"############### ####",
				"###      ###### ####",
				"### ####        ####",
				"### ################",
				"###     ############",
				"####### ############",
				"#######         ####",
				"####### ####### ####",
				"### ### #####   ####",
				"###   # ############",
				"#####   ##       ###",
				"#####      #####    ",
				"####################",
				"by.ccw_china,WASD移动",
				"       level:1       ",};
char b[100][100]={ "####################",
    				"#O  #####   ########",
    				"# ##    ###    #####",
   					"#   ######  ##  ####",
    				"###     #   ### ####",
    				"##  ###   ##    ####",
    				"#   #  ###### ######",
    				"#### ##         ####",
    				"##   #### ##  ######",
    				"#####    #   #######", 
    				"#######  ### ###### ",
    				"##    #####      ###",
    				"#  ##        ### ###",
    				"######  ######   ###",
    				"#       ##     #####",
    				"#####   ##### ######",
    				"######    #   ######",
    				"###   ##### ########",
    				"##                  ",
   					"####################",
    				"by.ccw_china, WASD移动",
    				"       level:2       "};
void hideCursor() //隐藏光标 
{ 
HANDLE hOut; 
CONSOLE_CURSOR_INFO cursorInfo; 
hOut=GetStdHandle(STD_OUTPUT_HANDLE); 
GetConsoleCursorInfo(hOut, &cursorInfo); 
cursorInfo.bVisible=0; 
SetConsoleCursorInfo(hOut, &cursorInfo);
}
int main()
{
	system("mode con cols=23 lines=31");
	int x,y;
	x=1,y=1;
	char ch;
	hideCursor();
	system("title 走迷宫");
	for(int i=0;i<=20;i++)
	{
		puts(a[i]);
	}
	while(1)
	{
		cout<

你可能感兴趣的:(c++,开发语言)