Hey guys i want to be able to print whatever is inside that array how many times the user inputs. For example user types in 2 i want it to display 2 rows and 2 columns. Or types in 3 i want it to display 3 rows and 3 columns. The array holds '?' up to 16 of them. i sorta done a little bit of it but stuck
if user selects 3
? ? ?
? ? ?
? ? ?
if user selects 2
? ?
? ?
Code:#define MAX_GRID 16 #define BLANK '' #define UNKNOWN '?' void printGridMineSize(char displayGrid[MAX_GRID][MAX_GRID], unsigned size, int getMineSize) { int i=0; int k=0; printf("-------------------\n"); for(i=0; i<size; i++) { for(k=0; k<size; k++) { printf(" %c \n",displayGrid[i][k]); printf(" +---+\n"); } printf("\n"); } } void init(char minefield[MAX_GRID][MAX_GRID], char displayGrid[MAX_GRID][MAX_GRID]) { int i; int j; for(i=0; i<MAX_GRID; i++) { for(j=0; j<MAX_GRID; j++) { minefield[i][j] = BLANK; displayGrid[i][j] = UNKNOWN; } } }



LinkBack URL
About LinkBacks


