Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
753 B
1
Indexable
Never
#include <iostream>
#include <cmath>

const int WIDTH = 80;
const int HEIGHT = 25;
const double PI = 3.14159265358979323846;

int main()
{
    for (double t = 0; t < 2 * PI; t += 0.1)
    {
        for (int y = -HEIGHT / 2; y < HEIGHT / 2; y++)
        {
            for (int x = -WIDTH / 2; x < WIDTH / 2; x++)
            {
                double dx = x * cos(t) - y * sin(t);
                double dy = x * sin(t) + y * cos(t);
                double d = sqrt(dx * dx + dy * dy);
                if (fabs(d - 10) < 3 || fabs(d - 20) < 3)
                    std::cout << "*";
                else
                    std::cout << " ";
            }
            std::cout << std::endl;
        }
        std::cout << std::endl;
    }
    return 0;
}