+ 1

How can I draw a rectangle in a frame using loops inc++?

The code for Rectangle

6th Feb 2020, 9:26 PM
Reem Ehab
Reem Ehab - avatar
4 odpowiedzi
+ 2
for(int i =0; i<5; i++){ if(i == 0 || i ==4) { //first and last cout << "*****************************"; } else { cout << "* *"; } } This should do it. You can adjust the length manually, as well as the height.
6th Feb 2020, 9:34 PM
Nikolay Ganev
Nikolay Ganev - avatar
+ 1
What you have so far? Make an attempt.. If you struck, then some one from community help you in better way.. Hope you understand.. That would be best practice. Edit: Just use a loop, for 2 dimensional array, when Either i, or j=0, or n(last row, print wall or char..) else leave a space.. So first row, and colomn, last row, and colomn need a char print everything else print a space...
6th Feb 2020, 9:32 PM
Jayakrishna 🇮🇳
+ 1
Is it a text based rectangle? Is it a hollow or filled rectangle?
7th Feb 2020, 2:27 AM
Sonic
Sonic - avatar
0
Think loops and nested loops.
7th Feb 2020, 2:27 AM
Sonic
Sonic - avatar