这个游戏代码出了点问题(后面的输出),求各位大佬帮忙来找错
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
using namespace std;
string g[1100];
int n,x=1,y=1,xx,fl;
char ch;
int main()
{
printf("欢迎来到迷宫游戏");
Sleep(3000);
system("cls");
printf("作者:xxx");
Sleep(3000);
system("cls");
printf("请输入迷宫的边长系数(3~30的数字),每个数字之间要用空格隔开,输入完后请按下回车\n");
cin>>n;
system("cls");
freopen("1.in","w",stdout);
cout<<n<<endl;
freopen("CON", "w", stdout);
WinExec("C://Users//Administrator//Desktop//游戏//地图.exe",SW_SHOWMAXIMIZED);
ShellExecute(NULL,"open","C://Users//Administrator//Desktop//游戏//地图.exe",NULL,NULL,SW_SHOWNORMAL);
freopen("1.out","r",stdin);
for(int i=0;i<=2*n+1;i++)
getline(cin,g[i]);
g[1][1]='O';
g[2*n-1][3*n-1]='@';
for(int i=0;i<=2*n+1;i++)
{
cout<<g[i];
cout<<endl;
}
while(x!=2*n-1||y!=3*n-1)
{
cin>>ch;
if(ch=='w'||ch=='W')
{
if(g[x-1][y]!='#')
{
g[x][y]=' ';
x--;
g[x][y]='O';
}
xx++;
}
if(ch=='s'||ch=='S')
{
if(g[x+1][y]!='#')
{
g[x][y]=' ';
x++;
g[x][y]='O';
}
xx++;
}
if(ch=='a'||ch=='A')
{
if(g[x][y-1]!='#')
{
g[x][y]=' ';
y--;
g[x][y]='O';
}
xx++;
}
if(ch=='d'||ch=='D')
{
if(g[x][y+1]!='#')
{
g[x][y]=' ';
y++;
g[x][y]='O';
}
xx++;
}
system("cls");
for(int i=0;i<=2*n+1;i++)
{
cout<<g[i];
cout<<endl;
}
if(xx>=200)
{
fl=1;
break;
}
}
system("cls");
if(!fl)
cout<<"你赢了";
else
cout<<"你已经超过了两百步,你输了";
return 0;
}