Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

int main() { // Define variables border and answer as type char // Define variab

ID: 3628559 • Letter: I

Question

int main()
{
// Define variables border and answer as type char

// Define variable isSolid as type bool

// Ask if the square is solid and save to the variable answer

// based on answer, assign isSolid to true or false

// Ask second question to get a character border to draw

// Draw five lines based on the value of isSolid and the border character

return 0;
}


this is how the ouput look like

Draw a 5 by 5 square: is it solid? (y/n) y
Give me the character to draw the border: b
Give me the character to draw the inner solid portion: i
bbbbb
biiib
biiib
biiib
bbbbb
Try again? (y/n) y
Draw a 5 by 5 square: is it solid? (y/n) n
Give me the character to draw the border: e
eeeee
e e
e e
e e
eeeee
Try again? (y/n) n
See you later!

Explanation / Answer

please rate - thanks

#include <iostream>
using namespace std;
int main()
{
// Define variables border and answer as type char
char border,inner, answer;
// Define variable isSolid as type bool
bool isSolid;
int i,j;
// Ask if the square is solid and save to the variable answer
do
{
cout<<"Draw a 5 by 5 square: is it solid? (y/n) ";
cin>>answer;
// based on answer, assign isSolid to true or false
if(answer=='y')
     isSolid=true;
else
     isSolid=false;
// Ask second question to get a character border to draw
cout<<"Give me the character to draw the border: ";
cin>>border;
if(isSolid)
     {cout<<"Give me the character to draw the inner solid portion: ";
      cin>>inner;
      }
else
     inner=' ';
// Draw five lines based on the value of isSolid and the border character
for(i=0;i<5;i++)
     cout<<border;
cout<<endl;
for(i=0;i<3;i++)
    {cout<<border;
    for(j=0;j<3;j++)
        cout<<inner;
    cout<<border<<endl;
    }
    
for(i=0;i<5;i++)
     cout<<border;
cout<<endl;

cout<<"Try again? (y/n) ";
cin>>answer;
}while(answer=='y');
cout<<"See you later! ";
system("pause");
return 0;
}