So I am trying to print a board exactly like this with the multidimensional array
char score[10][10] = {' '};
a b c d e f g h i j
+-------------------+
0| |
1| |
2| |
3| |
4| |
5| |
6| |
7| |
8| |
9| |
+-------------------+
Currently this is my code:
#include <iostream>
using namespace std;
#include <vector>
#include <string.h>
int main() {
char score[10][10] = {' '};
cout << " a b c d e f g h i j" << endl;
cout << " +-------------------+" << endl;
for (int i = 0; i < 10; i++) {
cout << " " << i << "|";
for (int j = 0; j < 10; j++) {
cout << score[i][j];
}
if(i == 0) {
cout << " |";
} else {
cout << " |";
}
cout << endl;
}
cout << " +-------------------+" << endl;
}
As you can see my code is inefficient and lengthy.
What would be the most efficient possible way ( or a more efficient way) of printing the board as exactly shown above with the multidimensional score array?