Untitled

 avatar
unknown
plain_text
2 years ago
920 B
4
Indexable
#include <graphics.h>
#include <iostream>

using namespace std;

int main() {
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "");

    int x = 100, y = 100;
    while (true) {
        cleardevice(); // clears the screen
        // draw the tires
        setcolor(BLACK);
        circle(x, y, 50);
        circle(x+150, y, 50);
        // draw the spokes
        int i;
        for (i = 0; i < 12; i++) {
            int angle = i * 30;
            int x1 = x + 50 * cos(angle * 3.14 / 180);
            int y1 = y + 50 * sin(angle * 3.14 / 180);
            int x2 = x + 60 * cos(angle * 3.14 / 180);
            int y2 = y + 60 * sin(angle * 3.14 / 180);
            line(x1, y1, x2, y2);
        }
        // rotate the tires
        x += 5;
        if (x > 650) {
            x = 100;
        }
        delay(50); // delay for animation
    }

    closegraph();
    return 0;
}
Editor is loading...