I'm trying to create a filled and unfilled rectangle class. I can easily create the filled, but the unfilled one is giving me a little difficulty. Whats going on?

void Rectangle::drawrec() 
{
if (filled == true) 
{ 
for (int row = 0; row < height; row++)
{ 
for (int col = 0; col < width; col++)
{
cout << "*";
}

cout << endl;

}
}
else

{
for (int row = 0 ; row < height; row++)
{
for (int col = 0 ; col < width ; col++)

{
if (height != width)
cout << " * ";

}

}

}
else
{
for (int col = 0 ; col < width ; col++)
{
for (int row = 0 ; row < height; row++)
{
if(col==0||row ==0||col==width-1||row==height-1)
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.