drawing a border for my array need border like this: 1 2 3 4 5 6 7 8 9 +--------
ID: 3691067 • Letter: D
Question
drawing a border for my array
need border like this:
1 2 3 4 5 6 7 8 9
+-------------------+
A | $ & % " $ ! $ % $ |
B | $ ! % # # # & " # |
C | & # % " ! $ ! & & |
D | " $ # & & ! # ! $ |
E | ! % & $ & ! & & ! |
F | " & & # # " % $ & |
G | & $ % $ & ! & % & |
H | $ % & % % " % # " |
I | # " ! # " $ " " ! |
+-------------------+
to go around my array that looks like this
int i, j;
for (i =0; i < 9; i++){
for ( j = 0; j <9; j++){
cout << static_cast<char>(theboard[i][j]);
}
cout << endl;
}
Explanation / Answer
int i, j;
char c = 'A';
cout<<"+-------------------+"<<endl;
for (i =0; i < 9; i++){
cout<<c<<"|";
for ( j = 0; j <9; j++){
cout << static_cast<char>(theboard[i][j]);
}
cout<<"|";
cout << endl;
c = c+1;
}
cout<<"+-------------------+"<<endl;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.