1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#include<stdio.h>
void printTable(char *tacToe[], int row, int col){
int i, x, y;
for(i = 0; i < col; i++){
printf("%3d", i+1);
}
printf("\n");
for(x = 0; x < row; i++){
printf("%2d", x+1);
for(y = 0; y < col; y++){
if(y == 0){
printf("%c", tacToe[x][y]);
}
printf("%3c", tacToe[x][y]);
}
}
}
void initTable(char *tacToe[], int row, int col){
int x, y;
for(x = 0; x < row; x++){
for(y = 0; y < col; y++){
tacToe[x][y] = '_';
}
}
}
int main(void){
int i;
char tacToe[3][3];
initTable(tacToe[3][3], 3, 3);
printTable(tacToe[3][3], 3, 3);
scanf("%d", &i);
}
|