孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#include <graphics.h>
#include <math.h>
#define PI 3.1415926
void main()
{
    double a;
    int x1, x2, color = 1;
    int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");
    cleardevice();
    for (a = 1; a <= 600; a +=1)
    {
        setcolor(color);
        x1 = 220+100 * cos(a / 47.75);
        x2 = 280+100 * sin(a / 47.75 - PI / 2);
        line(a, x1, a + 80, x1);
        line(a, x2, a + 80, x2);
        delay(10000);
        color++;
        if (color > 15)
            color = 1;
    }
    getch();
    closegraph();
}
posted on 2011-02-21 20:54  孤独的猫  阅读(164)  评论(0编辑  收藏  举报