求用wasd移动的代码,我的输入要按回车,还有光标```
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
char zl[20][40];
int n,x,y;
char c;
int main(){
memset(zl, ' ', sizeof zl);
while (1) {
zl[y][x] = '&';
for (int i = 0; i < 20; i ++) {
for (int j = 0;j < 40; j++){
cout << zl[i][j];
}
cout << endl;
}
memset(zl, ' ', sizeof zl);
cin >> c;
if (c == 'w')y -= 1;
if (c == 's') y += 1;
if (c =='a') x -= 1;
if (c == 'd') x += 1;
system ("cls");
}
return 0;
}