-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
81 lines (75 loc) · 1.76 KB
/
main.cpp
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
79
80
81
#include <iostream>
using namespace std;
int main() {
int i,num=8,n;
n = num/2;
int x = n;
cout<<num<<"\t"<<n<<endl;
for (i=1;i<=n;i++){
for (int j = n-i; j > 0; j--) {
cout<<"*";
}
cout<<" ";
if (i%2 == 0) {
if (i > 3) {
for (int o = 0; o <= i+1; o++) {
if (i != 1) { cout<<"*"; }
}
} else {
for (int o = 0; o < i; o++) {
if (i != 1) { cout<<"*"; }
}
}
} else {
for (int o = 0; o <= i; o++) {
if (i != 1) { cout<<"*"; }
}
}
cout<<" ";
for (int m = n-i; m > 0; m--) {
cout<<"*";
}
x--;
// Bottom Portion
if (x == 0) {
for (int j = 0; j < n-i; j++) {
cout<<"*";
}
}
cout<<endl;
}
for (i=n;i>=1;i--){
for (int j = n-i; j > 0; j--) {
cout<<"*";
}
cout<<" ";
if (i%2 == 0) {
if (i > 3) {
for (int o = 0; o <= i+1; o++) {
if (i != 1) { cout<<"*"; }
}
} else {
for (int o = 0; o < i; o++) {
if (i != 1) { cout<<"*"; }
}
}
} else {
for (int o = 0; o <= i; o++) {
if (i != 1) { cout<<"*"; }
}
}
cout<<" ";
for (int m = n-i; m > 0; m--) {
cout<<"*";
}
x--;
// Bottom Portion
if (x == 0) {
for (int j = 0; j < n-i; j++) {
cout<<"*";
}
}
cout<<endl;
}
return 0;
}