-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartree1.cpp
More file actions
66 lines (63 loc) · 1.78 KB
/
startree1.cpp
File metadata and controls
66 lines (63 loc) · 1.78 KB
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
#include "stdafx.h"
#define Lspace 10
int spacef(int);
void process(int);
int input;
int main()
{
cin >> input;
process(spacef(input));
return 0;
}
void process(int space)
{
int wnf, j, k = 1, mst = 1;
wnf = space;
for (int i = 1; i <= input; i++)
{
if (i % 4 == 1)
{
if (i != 1)
{
mst += 4;
}
space -= 4;
k = 1;
}
for (j = 1; j <= space - ((space / 2) - k) + 2+Lspace; j++)
{
printf(" ");
}
for (j = mst; j < i * 2;j++)
{
printf("*");
}
if (j >= i * 2)
{
k--;
}
printf("\n");
}
for (int i = 0; i < wnf / 4;i++)
{
for (j = 0; j < wnf / 4 + 1+Lspace; j++)
{
printf(" ");
}
for (j = 0; j < wnf / 2 + 1; j++)
{
printf("*");
}
printf("\n");
}
}
int spacef(int input)
{
for (int i = input; i <= input + 4; i++)
{
if (i % 4 == 0)
{
return i;
}
}
}