There is a one-dimensional array 4, it must be filled with random numbers through the Rand (), and they must be unique. The most important thing, everything needs to be done by the template that I led below.
# include & lt; iostream & gt;
#Include & lt; Ctime & gt;
Using Namespace STD;
INT MAIN ()
{
SETLOCALE (0, "RUS");
SRAND (TIME (NULL));
BOOL GAME;
INT ARR [4];
for (int i = 0; i & lt; 4; i ++)
{
for (int j = 0; j & lt; 4;)
{
Game = True;
Arr [j] = Rand ()% 16;
for (int k = 0; k & lt; j; k ++)
{
if (arR [k] == arr [j])
{
Game = False;
}
}
if (Game == True)
{
j ++;
}
}
}
Answer 1, Authority 100%
Here, your code with minimal changes:
# include & lt; iostream & gt;
#Include & lt; Ctime & gt;
Using Namespace STD;
INT MAIN ()
{
SRAND (TIME (NULL));
BOOL GAME;
INT ARR [4] [4];
for (int i = 0; i & lt; 4; i ++)
{
for (int j = 0; j & lt; 4;)
{
Game = True;
Arr [i] [j] = Rand ()% 16;
for (int r = 0; r & lt; 4; r ++)
for (int c = 0; c & lt; 4; C++)
{
if (r == i & amp; & amp; c == j)
{
r = c = 4;
Continue;
}
if (arR [R] [C] == Arr [i] [j])
{
Game = False;
r = c = 4;
}
}
if (Game == True)
{
j ++;
}
}
}
for (int i = 0; i & lt; 4; i ++)
{
for (int j = 0; j & lt; 4; j ++)
COUT & LT; & LT; Arr [i] [j] & lt; & lt; "";
COUT & LT; & LT; "\ n";
}
}
Possible pin :
3 11 1 10
0 15 8 4
12 7 9 5
13 2 14 6