Moving object in c++

Hi everyone. I need your help

I want to make an object in array[][] move

Ex:
array[2][5]
array[0][0] = 'O'

O| | | | |
| | | | |
| | | | |

then
|O| | | |
| | | | |
| | | | |
then
| |O| | |
| | | | |
| | | | |

......

how can i print my array in console then change&print it again, then change&print it again,...
So it look like O is moving
???
Thanks in advance!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
using namespace std;

int main () {

char a[6][4];
for (int i=0;i<6;i++) {
	for (int j=0;j<4;j++) {
		 a[i][j] = '.' ;
	}
}

int x=0,y=0;
a[x][y] = 'P';

while(1){
	
	for (int i=0;i<6;i++) {
		for (int j=0;j<4;j++) {
			 cout << a[i][j] << " " ;
			 if (j==3)
			    cout << endl;
			}
			
	}
	a[x][y] = '.';
	cout << "\n\n";
			
	cout<< "x, y = ";
	cin >> x >> y;
	a[x][y] = 'P';
	cout << "\n\n";		
}			
	
 return 0;
}
Topic archived. No new replies allowed.