cat and mouse 2d array

Using the following code, how do i get the cat to eat a mouse? What i want the program to do is to have the user input cordinates to where the cat should go to eat the mouse. Once it eats the mouse, I guess the mouse should no longer show up on the grid.

Can someone help me get started?
So far I have been able to at least get the cin and couts for the user to enter the cordinates but i havent been able to do anything with that :(


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
37
38
39
// Cat and Mouse.cpp : main project file.


#include <ctime>
#include <iostream>

using namespace std;

int main()
{
   time_t t;
   srand((unsigned) time(&t)); 
	char maze[8][8];
	int x, y, count;
	for(x=0;x<8;x++)
		for (y=0;y<8;y++)
			maze[x][y] = '.';
	maze[7][0] = 'C'; // Cat

	for (count =0;count<3;count++)
	{
		do
		{
			x=rand()%8; // random row
			y=rand()%8; // random column
		}while (maze[x][y]!='.'); // So we don't over-write a used space
		maze[x][y]='M';// place mouse at maze[x][y]
	}
	for(x=0;x<8;x++)
	{
		for (y=0;y<8;y++)
		{
			cout << maze[x][y]<< " ";
		}
	cout << endl;
	}

    return 0;
}
Topic archived. No new replies allowed.