Start New Discussion Reply to this Discussion Creating filled/unfilled rectangle class.
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 << " * ";
}
}
}
Related Article: Wrapper Class? C++
is a solved C++ discussion thread by danny2000 that has 3 replies, was last updated 10 months ago and has been tagged with the keywords: wrapper, class, c++.
stan2000
Newbie Poster
6 posts since Mar 2011
Reputation Points: 7
Solved Threads: 0
Skill Endorsements: 0
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;
}
}
mazzica1
Junior Poster
148 posts since Oct 2011
Reputation Points: 9
Solved Threads: 27
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page rendered in 0.0578 seconds
using 2.65MB