Complete the printtictactoe function with char parameters horizchar and vertchar that prints a tic-tac-toe board with the characters as follows. end with newline. ex: printtictactoe('~', '!') prints:

Respuesta :

tonb
void printtictactoe(char horizchar, char vertchar)
{
int i,j;
int scale = 5;

for(j=0; j<3; j++) {
   for (i = 0; i < scale; i++)
      printf("%*c%*c\n", scale+1, vertchar, scale+1, vertchar);
      if (j < 2) 
         for (i = 0; i < (scale * 3)+2; i++)
             printf("%c", horizchar);
             printf("\n");
    }
}

I left out many braces because of the layout issues with this website. There is a scale factor you can set to the desired size of the board cells!