We were just given a compiled C code in .exe format and a word file explaining vaguely what to do and we were asked to model our game on it.
I've only gotten as far as the code i've shown below.
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <conio.h>
#define ROW 10
#define COL 10
int x,y;
int main()
{
int r=1;
int arr[ROW][COL];
char name[20];
printf("-------NUMBER CRUSH-------\n***************************\n\n");
printf("Enter your name: ");
scanf("%c", &name);
system("cls");
r=1;
while(r=1)
{
printf("-------NUMBER CRUSH-------\n***************************\n\n");
printf("Welcome %c, LET'S PLAY!!\n\n", name);
initialize(arr);
printf("\n\n");
printf("to regenerate the array press 1: ");
scanf("%i", &r);
system("cls");
}
return 0;
}
/*define grid and populate with random numbers and print to screen*/
int initialize(int grid[ROW][COL])
{
int n;
srand(time(NULL));
for(x=0;x<10;x++)
{
for(y=0;y<10;y++)
{
n=2+rand()%7;
grid[x][y]=n;
printf("%d ", n);
}
printf("\n\n\n");
}
return 0;
}