Random Numbers Multi-Dimensional Arrays

I want the user to input 2 rows and 2 columns.
Then the program will generate a random number in that certain place and if both of the are equal, you win and if it's not equal, you lose.

|* * * *
|* * * *
|* * * *
|* * * *

Please enter row
3
Please enter column
3
Please enter row
2
Please enter column
1

|* * * *
|7 * * *
|* * 2 *
|* * * *
You lose!
Enter 1 to play again. Enter 0 to quit.

or

|* * * *
|* * * *
|* * * *
|* * * *

Please enter row
3
Please enter column
3
Please enter row
2
Please enter column
1

|* * * *
|2 * * *
|* * 2 *
|* * * *
You win!
Enter 1 to play again. Enter 0 to quit.

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
40
41
42
43
44
45
46
47
48
  #include<iostream>
using namespace std;

int main()
{
	int table[4][4], row1, row2, column1, column2, choice;

	do
	{
		system("cls");
		cout << " 1 2 3 4 \n\n";
		cout << "----------" << endl;
		for (int i = 0; i < 4; i++)
			cout << "|* * * *" << endl;

		cout << "Please insert row \n";
		cin >> row1;
		cout << "Please insert column \n";
		cin >> column1;
		cout << "Please insert row \n";
		cin >> row2;
		cout << "Please insert column \n";
		cin >> column2;

		for (int i = 0; i < row1; i++) {
			for (int c = 0; c < column1; c++) {
				cout << rand() % table[i][c];
			}
		}

		for (int i = 0; i < row2; i++) {
			for (int c = 0; c < column2; c++) {
				cout << rand() % table[i][c];
			}
		}
		cout << " 1 2 3 4 \n\n";
		cout << "----------" << endl;
		for (int i = 0; i < 4; i++)
			cout << "|* * * *" << endl;

		cout << "Enter 1 to play again. Enter 0 to quit. ";
		cin >> choice;

	} while (choice == 1);

	system("pause>0");
	return 0;
}
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
40
41
#include<iostream>
using namespace std;

int main()
{
	int table[4][4], row1, row2, column1, column2, choice;

	do
	{
		system("cls");
		cout << " 1 2 3 4 \n\n";
		cout << "----------" << endl;
		for (int i = 0; i < 4; i++)
			cout << "|* * * *" << endl;

		cout << "Please insert row \n";
		cin >> row1;
		cout << "Please insert column \n";
		cin >> column1;
		cout << "Please insert row \n";
		cin >> row2;
		cout << "Please insert column \n";
		cin >> column2;

	
		cout << rand() % table[row1][column1];
		cout << rand() % table[row2][column2];

		cout << " 1 2 3 4 \n\n";
		cout << "----------" << endl;
		for (int i = 0; i < 4; i++)
			cout << "|* * * *" << endl;

		cout << "Enter 1 to play again. Enter 0 to quit. ";
		cin >> choice;

	} while (choice == 1);

	system("pause>0");
	return 0;
}

FIXED IT A LITTLE BUT I STILL CAN'T DO IT LOL
I updated it and the output i have is this:
|* * * *
|* * * *
|* * * *
|* * * *

Please enter row
3
Please enter column
3
Please enter row
2
Please enter column
1

|6
|9
|8
|5
Enter 1 to play again. Enter 0 to quit.
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
40
41
42
43
44
45
46
47
48
49
50
#include<iostream>
using namespace std;

int main()
{
	int table[4][4], row1, row2, column1, column2, choice;

	do
	{
		system("cls");
		cout << " 1 2 3 4 \n\n";
		cout << "----------" << endl;
		for (int i = 0; i < 4; i++)
			cout << "|* * * *" << endl;

		cout << "Please insert row \n";
		cin >> row1;
		cout << "Please insert column \n";
		cin >> column1;
		cout << "Please insert row \n";
		cin >> row2;
		cout << "Please insert column \n";
		cin >> column2;

		cout << endl; 

		cout << " 1 2 3 4 \n\n";
		cout << "----------" << endl;
		for (int i = 0; i < 2; i++){
			for (int j = 0; j < 2; j++)
			{
				cout << "|";
				if (table[i][j] == table[row1][column1])
					cout << 1 + (rand() % 9) << endl;
				else if (table[i][j] == table[row2][column2])
					cout << 1 + (rand() % 9) << endl;
				else if (table[i][j] != table[row1][column1])
					cout << "*";
				else if (table[i][j] != table[row2][column2])
					cout << "*";
			}
		}
		cout << "Enter 1 to play again. Enter 0 to quit. ";
		cin >> choice;

	} while (choice == 1);

	system("pause>0");
	return 0;
}
For you guys to understand my problem, it's a memory game! Thank you!
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void random(int[][4]);

int main()
{
	int choice, r1, c1, r2, c2, cards[4][4], i(0);
	bool cardstatus[4][4];  
	bool gameover = false; 
	int moves;
	do
	{
		system("cls");
		moves = 0;
		random(cards);
		cout << "    1 2 3 4\n";
		cout << "  ";
		for (int i = 0; i <= 8; i++)
		{
			cout << "-";
		}
		cout << endl;
		for (int r = 0; r<4; r++)
		{
			cout << r + 1 << " | ";
			for (int c = 0; c<4; c++)
			{
				cout << "* ";
				cardstatus[r][c] = false; 
			}
			cout << endl;
		}
		cout << endl;
		do
		{
			cout << "Please insert the row\n";
			cin >> r1;
			cout << "Please insert the column\n";
			cin >> c1;
		} while (cardstatus[r1 - 1][c1 - 1] != false);
		do
		{
			cout << "Please insert the row\n";
			cin >> r2;
			cout << "Please insert the column\n";
			cin >> c2;
		} while (cardstatus[r2 - 1][c2 - 1] != false);
		r1--;
		c1--;
		r2--;
		c2--;
		cout << "    1 2 3 4\n";
		cout << "  ";
		for (int i = 0; i <= 8; i++)
		{
			cout << "-";
		}
		cout << endl;
		for (int r = 0; r<4; r++)
		{
			cout << r + 1 << " | ";
			for (int c = 0; c<4; c++)
			{
				if ((r == r1) && (c == c1))
				{
					cout << cards[r][c] << " ";
				}
				else if ((r == r2) && (c == c2))
				{
					cout << cards[r][c] << " ";
				}
				else if (cardstatus[r][c] == true)
				{
					cout << cards[r][c] << " ";
				}
				else
				{
					cout << "* ";
				}
			}
			cout << endl;
		}
		if (cards[r1][c1] == cards[r2][c2]) 
		{
			cout << "Cards Matched!" << endl;
			cout << "Congratulations, You won!!!" << endl;

			cardstatus[r1][c1] = true;
			cardstatus[r2][c2] = true;
		}
		else
		{
			cout << "You Lose!" << endl;
		}
		cout << "Enter 1 to play again. Enter 0 to quit. ";
		cin >> choice;
	} while (choice == 1);
	cin.get();
	return 0;
}

void random(int cards[][4])
{
	int start[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 };
	for (int s = 0; s <= 20; s++)
	{
		for (int x = 0; x<16; x++)
		{
			srand((unsigned)time(NULL));
			int i = rand() % 15 + 1;
			int temp = start[x];
			start[x] = start[i];
			start[i] = temp;
		}
	}
	int i = 0;
	for (int r = 0; r<4; r++) 
	{
		for (int c = 0; c<4; c++)
		{
			cards[r][c] = start[i];
			i = i + 1;
		}
		cout << endl;
	}
}

Fixed it
Topic archived. No new replies allowed.