-
Notifications
You must be signed in to change notification settings - Fork 1
/
11 Task
192 lines (176 loc) · 4.06 KB
/
11 Task
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#include <iostream>
using namespace std;
int main() {
setlocale(0, "");
int figure, type, length2, size, width, high;
int length1 = 0;
char texture;
cout << "Геометрические фигуры!" << endl;
cout << "[1] Линия" << endl;
cout << "[2] Квадрат" << endl;
cout << "[3] Прямоугольник" << endl;
cout << "[4] Треугольник" << endl;
cout << "[5] Решетка" << endl;
cout << "Выберите фигуру: ";
cin >> figure;
system("cls");
if (figure == 1) {
cout << "Фигура: Линия " << endl;
cout << "[1] Горизонтальная" << endl;
cout << "[2] Вертикальная" << endl;
cout << "Выберите тип:" << endl;
cin >> type;
cout << "Введите длину: ";
cin >> length2;
cout << "Введите текстуру: ";
cin >> texture;
cout << "Результат:" << endl;
switch (type) {
case 1:
while (length1 < length2) {
cout << texture;
length1++;
}
break;
case 2:
while (length1 < length2) {
cout << texture << endl;
length1++;
}
break;
default:
cout << "Такого типа фигуры не существует";
break;
}
}
else if (figure == 2) {
cout << "Фигура: Квадрат " << endl;
cout << "[1] Заполненный" << endl;
cout << "[2] Пустой" << endl;
cout << "Выберите тип: ";
cin >> type;
cout << "Размер: ";
cin >> size;
cout << "Текстура квадрата: ";
cin >> texture;
cout << "Результат:" << endl;
switch (type) {
case 1:
for (int y = 0; y < size; y++) {
for (int x = 0; x < size; x++) {
cout << texture << " ";
}
cout << "\n";
}
break;
case 2:
for (int y = 0; y < size; y++) {
for (int x = 0; x < size; x++) {
if (y == 0 || y == size - 1 || x == 0 || x == size - 1) {
cout << texture << " ";
}
else {
cout << " ";
}
}
cout << "\n";
}
break;
}
}
else if (figure == 3) {
cout << "Фигура: Прямоугольник" << endl;
cout << "[1] Заполненный" << endl;
cout << "[2] Пустой" << endl;
cout << "Выберите тип: ";
cin >> type;
cout << "Ширина: ";
cin >> width;
cout << "Высота: ";
cin >> high;
cout << "Текстура: ";
cin >> texture;
cout << "Результат:" << endl;
switch (type) {
case 1:
for (int y = 0; y < high; y++) {
cout << "\t";
for (int x = 0; x < width; x++) {
cout << texture << " ";
}
cout << "\n";
}
break;
case 2:
for (int y = 0; y < high; y++) {
for (int x = 0; x < width; x++) {
if (y == 0 || y == high - 1 || x == 0 || x == width - 1) {
cout << texture << " ";
}
else {
cout << " ";
}
}
cout << "\n";
}
break;
}
}
else if (figure == 4) {
cout << "Фигура: Треугольник" << endl;
cout << "[1] Заполненный" << endl;
cout << "[2] Пустой" << endl;
cout << "Выберите тип: ";
cin >> type;
cout << "Высота: ";
cin >> high;
cout << "Текстура: ";
cin >> texture;
cout << "Результат: " << endl;
switch (type) {
case 1:
for (int y = 0; y < high; ++y)
{
for (int x = high; x > y; --x) {
cout << ' ';
}
for (int x = 0; x < 2 * y - 1; ++x) {
cout << texture;
}
cout << endl;
}
break;
case 2:
for (int y = 0; y < high; y++) {
for (int x = 0; x < high; x++) {
if (y == high/2 || x == (high/2) + y || x == (high/2) - y) {
cout << texture;
}
else {
cout << " ";
}
}
cout << endl;
}
break;
}
}
else if (figure == 5) {
cout << "Фигура: Решетка" << endl;
cout << "Размер: ";
cin >> size;
cout << "Текстура: ";
cin >> texture;
cout << "Результат: " << endl;
for (int y = 0; y < size; y++) {
for (int x = 0; x < size; x++) {
if (y % 2 == 1 || x % 2 == 1) {
cout << texture;
}
else {
cout << " ";
}
}
cout << endl;
}
}