Question: This is in C. Edit the program by adding a code where it days add your code here so it prints out a game board

This is in C. Edit the program by adding a code where it days "add your code here" so it prints out a game board with all cards facing up with random initial integer values (the x-axis and y-axis are not required). test game board generation and printing generate random "cards" of values 0 to k = 12 and place them on the nxm (5x6) game board. Note: the cards must be in pairs. If both n and m are odd numbers, assign one random position to be -1.

#include

#include

#include

int main()

{ int n=5, m=6; // dimension of the game board

int k = 12;

int A[5][6];

int s = 1234;

int i, j;

srand(s);

for (i=0; i

for (j=0; j

A[i][j] = -1; // initially no cards on the board

// add your code here to generate cards and place them on the game board

for (i=0; i

{ for (j=0; j

printf("%5d", A[i][j]);

printf(" ");

}

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!