so currently, I have a program that prints out
1 2 3 4 5
|
@****
**@**
*@***
*****
@@***
|
and I need to add a border around it to make it look something like this
1 2 3 4 5 6 7 8 9 10 11 12
|
// this isn't printing out 100% correctly but you get the jist
/*
0 1 2 3 4
+--------------+
0| * * * @ * |
1| * * * * * |
2| @ @ * * * |
3| * * @ * @ |
4| @ * * * * |
+-----------+
*/
|
how would I go about doing that?
this is what I have so far
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
void displayBoard(Symbols symbolArr[ROWS][COLS])
{
for (int i = 0; i < ROWS; i++) //ROWS = 5
{
cout << i <<'|';
for (int j = 0; j < COLS; j++) //COLS = 5
{
cout << " ";
cout << static_cast<char>(symbolArr[i][j]) << "";
}
cout << endl;
}
return;
}
|
and it prints out
1 2 3 4 5
|
0| * * * @ *
1| * @ @ * *
2| * * * * @
3| @ * @ @ *
4| * * * * @
|
what else do I need to do here? Thanks
Last edited on
one way would be change
cout << endl;
to
cout << "|" << endl;
thanks. How would I go about implementing the top part? do I need to do some sort of nested for looop?
right now it looks like this.
1 2 3 4 5 6 7
|
/*
0| * * * @ *|
1| * @ @ * *|
2| * * * * @|
3| @ * @ @ *|
4| * * * * @|
*/
|
Last edited on
nevermind, I figured it out.
I just called a cout function with
"0 1 2 3 4"
outside of the for loop