I'm currently working on a project where a user is prompted to enter the height, width, and the character they would like to use for their box. I have to create a solid and hollow box using for loops. I have created the solid one with no problems, but when it comes to the hollow one, I run into some issues. Any help is appreciated.
int main()
{
int height;
int width;
int i, j;
char ch;
cout << "Please enter your height: ";
cin >> height;
cout << "Please enter your width: ";
cin >> width;
cout << "Please enter your character: ";
cin >> ch;
for (i = 1; i <= height; i++)
{
for (j = 1; j <= width; j++)
cout << ch;
cout << endl;
}
cout << "Press any key to continue to the next shape." << endl;
_getch();
for (i = 1; i <= height; i++)
{
for (j = 1; j <= width; j++)
{
if (i == 1 || i == width -1 || j == 1 || j == height )
cout << ch;
else cout << " ";
}
cout << endl;
}
system("pause");
return 0;
}