I'm looking to make a checkers board..
A typical square of checkers board looks like
my point it is, how do I print the board with rows and columns taken as input.. where should I start and how do I proceedPHP Code:
+-----+
| |
| |
| |
+-----+
I'm looking to make a checkers board..
A typical square of checkers board looks like
my point it is, how do I print the board with rows and columns taken as input.. where should I start and how do I proceedPHP Code:
+-----+
| |
| |
| |
+-----+
How about a loop which prints "+-----" a number of times.
And a loop which prints "| " a number of times.
Then loops calling those loops.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I even thought about it but the problem comes when I want something like this...
as printf() takes \n by default... so, how would I handle this.PHP Code:
+-----+-----+
| | |
| | |
| | |
+-----+-----+
I would suggest you spend the next day thinking about how this works then.
Code:#include <stdio.h> void foo ( void ) { for ( int i = 0 ; i < 8 ; i++ ) printf("+----"); printf("+\n"); for ( int i = 0 ; i < 3 ; i++ ) { for ( int j = 0 ; j < 8 ; j++ ) printf("| "); printf("|\n"); } } int main() { for ( int i = 0 ; i < 8 ; i++ ) foo(); return 0; }
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.