HELP! Drawing a Diamond

Hey guys, I have a project due for school, we have to draw a diamond using for loops, i've got it all finished except the Draw function. I'm gonna copy/paste what I have, if someone can look it over and help me come up with a draw function or point me in the right direction that'd be great!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "diamond.h"
using namespace std;

Diamond::Diamond (int size, char borderchar, char fillchar)
{
	if (size<1)
	{
		size=1;
	}
	if (size>39)
	{
		size=39;
	}
	SetBorder(borderchar);
	SetFill(fillchar);
}

int Diamond::GetSize()
{
	return size;
}

int Diamond::Perimeter()
{
	return size*4;
}

int Diamond::Area()
{
	return size*size;
}

void Diamond::Grow()
{
	if (size <=38 && size >= 1)
		size=size++;

	else
		size=1;
}

void Diamond::Shrink()
{
	if (size >=2 && size<=40)
		size=size--;
	else
		size=1;
}

void Diamond::SetBorder(char borderchar)
{
	if (borderchar >='!' && borderchar <='~')
	{
		border = borderchar;
	}
	else
	{
		border = '#';
	}
}

void Diamond::SetFill(char fillchar)
{
	if (fillchar >='!' && fillchar <='~')
	{
		fill = fillchar;
	}
	else
	{
		fill = '*';
	}
}

void Diamond::Draw()
{
        for (





Last edited on
First align the code and wrap it in code block. Then it'll be easy for us to understand what you are trying to do.
just did, thanks!
great !!! Now what should this Draw() do? From the name I think you have to output some * in such a way that in the console it appears like a diamond. So, tell us which all member variables are there in your Diamond class that you need to use while drawing a diamond. Or in other words, how should the diamond be drawn?
Topic archived. No new replies allowed.