I am supposed to be creating a house with characters that combine an empty equilateral triangle and an empty square and both are to be filled in with other characters.
It's not going to show correctly, but it is supposed to look like an
empty arrow but can be filled with characters. the top triangle is an equilateral triangle on top of a square and the triangle is to be 2 sizes biggire than the square.
This supposed to be a test for a draw(); function for a house class that the size entered through a driver changes the size of the house, border, and fill.
I made a separate cPP file trying to test how the shape should show.
This is the only part that confuses me.
Here's my code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int times;
char star = '*';
int l = 1;
for (int i = 0;i<7;i++)
{
for (int j = 7; j>i;j--)
{
cout << " ";
#include <iostream>
#include <iomanip>
usingnamespace std;
constchar star = '*';
class House
{
public:
void Draw (int size);
};
void House::Draw (int size)
{ int l = 1;
for (int i = 0;i<size;i++)
{ for (int j = size; j>i; j--)
{ cout << " ";
}
cout << star;
if (i!=0)
{ for (int k=1; k<=l; k++)
{ cout << " ";
}
cout << star;
l+=2;
}
cout << endl;
}
for(int s=0; s<size-2; s++)
{ for (int i =0; i<size;i++)
{ cout << " ";
cout << star;
}
cout<<endl;
}
}
int main()
{ House house;
house.Draw (8);
system ("pause");
return 0;
}
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.