+ 2
Help me fix this code
Please help me fix this code, it should be print like a box with pound sign as a fence. But there was another pound sign far from the box showed up. Anyone can help me, please? Thanks and sorry for my english ######### # # # # # # # # # # # ######### https://code.sololearn.com/c4Nf30mDfup6/?ref=app
5 Answers
+ 1
You aren't printing a new line after the first loop. And also you have to print "#" in the first loop "width + 1" times as you do in the third loop.
+ 1
There should be an endl after the first for statement (in line 15):
cout << endl;
+ 1
ok thanks it work
+ 1
If I may suggest another change?
I would change line 22 from if(i==9)
to
if (i == width -1)
Your code will then still work if you change the width to another value.
0
ok I will try it