the question given like this
The TetraPek manager assumed that you are already familiar with the game rules. Now, the
manager wants your program to be able to auto-generate some numbers before the player gets to
key in their numbers into the empty boxes. It is up to you how these starting numbers are generated.
Among some ideas you can consider: You can have preset locations for preset numbers, or you can
also randomly generate the numbers and positions for more playing fun.
Note that each row, each column and each quadrant (4 boxes) will only have two auto-generated
numbers. The important part is to make sure that the numbers generated are within the range from 1
to 4, and also fulfill all game rules. If not, the game might be unplayable!
The following grid is an example of how the starting numbers can be generated
--------------------------------------------------------------------
| 3 | | 4 | |
---------------------------------------------------------------------
| | 1 | | 2 |
----------------------------------------------------------------------
| | 4 | | 3 |
----------------------------------------------------------------------
| 2 | | 1 | |
----------------------------------------------------------------------
There should be eight (8) auto-generated numbers (ranging from 1 to 4) at the beginning of thegame.
Next, allow the user to enter numbers for the empty boxes into your program. The user shouldhave the choice of selecting which box he/she wants to fill in. This approach is user-friendly
since the user no longer needs to fill in following a particular rigid order.
i have done with that game .im having problem with generate random numbers on mentioned position on above box .
i tried a bit with that function .but it didnt work .
intialize box function ;
void crate game ()
{
for(int i=1 ;i<=4 ;i++)
{
C11=random(i);
C12=' ';
C13=random(i);
C14=' ';
C21=random(i);
C22=' ';
C23=' ';
C24=random(i);
C31=' ';
C32=random(i);
C33=' ';
C34=random(i);
C41=random(i);
C42=' ';
C43=random(i);
C44=' ';
my random function "
int random (int n){
for(int i=1;i<=4;i++)
{
i =rand();
return i;
}
}
can any one help me to finish this ?