Mine is a bit different from yours, sorry, but I already had it done. You should be able to figure it out from this code though.
Code:
#include <iostream.h>
void draw_square(int length, char character)
{
cout << "+ ";
for (int horizontal=0; horizontal < (length-2); horizontal++)
{
cout<<"- ";
}
cout << "+" << endl;
for (int vertical=0; vertical<(length-2); vertical++)
{
cout << "| ";
for (int whitespace=0; whitespace < (length + length - 5); whitespace++)
{
cout << character;
}
cout << " |" << endl;
}
cout << "+ ";
for (horizontal=0; horizontal < (length-2); horizontal++)
{
cout<<"- ";
}
cout << "+" << endl;
}
int main()
{
int length_of_square=0;
char userchar=0;
cout << "Enter the length of the square" << endl;
cin >> length_of_square;
cout<<"What character should we use?"<<endl;
cin>>userchar;
if (length_of_square == 0)
return 0;
if (length_of_square < 0)
{
cout << "Incorrect length.";
return 0;
}
draw_square(length_of_square, userchar);
return 0;
}