PDA

View Full Version : Memory Game in C Programming



Polaris
February 29th, 2008, 11:19 AM
Another assignment I have is to build a Memory game.

http://www.egr115.com/prog05_memory.pdf

...and the code I am given to work with is...

#include "stdio.h"
#include "stdlib.h"
#include "memory.h"

int main()
{
int grid[5][6];
int matched[5][6];

int i=0, j=0;

// Generate the grid
Generate(grid);

// Generate the matched grid
for (i=0; i<5; i++)
{
for (j=0; j<6; j++)
{
if (i==0 || j==0 || i==j)
{
matched[i][j] = 0;
} // end of if

else
{
matched[i][j] = 1;
} // end of else

} // end of for j

} // end of for i

// Display the grid
Display(grid, matched);


system("pause");

} // end of main()

This is an example of what it is suppose to look like.

http://www.egr115.com/prog05distrib.exe