Files
dz4/flag_for_emin.cpp
2024-11-09 15:14:02 +03:00

25 lines
955 B
C++

void z4() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
const int width = 20; // Ширина флага
const int height = 10; // Высота флага
const int centerX = width / 2;
const int centerY = height / 2;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
// Определяем, находится ли точка (x, y) внутри круга
int dx = x - centerX;
int dy = y - centerY;
if (dx * dx + dy * dy <= circleRadius * circleRadius) {
}
else {
SetConsoleTextAttribute(hConsole, 0xf0); // Белый цвет
}
cout << " "; // Два пробела для более широкого изображения
}
cout << endl;
}
SetConsoleTextAttribute(hConsole, 15); // Сбрасываем цвет на белый
}