字符串数组定义没问题,可是输出却莫名有问题,求解答
#include<bits/stdc++.h>
#include<windows.h>
#include <conio.h>
using namespace std;
void S(int x,int y)
{
COORD pos;
pos.X=y*2+1,pos.Y=x+1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
string map[7]={
{"###########"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"###########"}
};
int bou=0;
bool bou2;
int x=5,y=1;
char role;
char f;
int main(){
cout<<"角色名称(字符):";
cin>>role;
system("cls");
for(int i=0;i<7;i++){
cout<<map[i];//这里运行错误
cout<<endl;
}
while(1){
f=getch();
if(f=='w'&&bou==0){
bou2=1;
}
if(f=='a'&&map[x][y-1]==' '){
S(x,y);
cout<<" ";
S(x,y+1);
cout<<role;
}
}
return 0;
}