Thứ Tư, 24 tháng 12, 2014

vẽ hình lưới ô vuông và những đường chéo


#include <graphics.h>
#include <conio.h>
int main()
{
    int i,n,h=600,d=5,j;
    int t=h/d;
    initwindow(h,h);
    for(i=0;i<=d;i++)
    {
        for(j=0;j<=d;j++)
        {
            setcolor(14);
            line(t+i*t,j*t,i*t,t+j*t);
            delay(500);
            setcolor(12);
            line(i*t,j*t,t+i*t,t+j*t);
            delay(500);
            rectangle(i*t,j*t,h,t+j*t);
        }
    }
getch();
return 0;
}

Không có nhận xét nào: