PLOY01.C
资源名称:几何图形的画法.rar [点击查看]
上传用户:dzj2008
上传日期:2013-03-27
资源大小:94k
文件大小:1k
源码类别:
分形几何
开发平台:
Visual Basic
- #include<conio.h>
- #include<stdio.h>
- #include<graphics.h>
- struct polyvetex{
- int x;
- int y;
- };
- struct polyvetex outside[7];
- struct polyvetex inside[4];
- main()
- {
- int driver,mode,i;
- driver=DETECT;
- mode=0;
- /*struct polyvetex outside[7];
- struct polyvetex inside[4];*/
- outside[0].x=100;
- outside[0].y=100;
- outside[1].x=300;
- outside[1].y=100;
- outside[2].x=400;
- outside[2].y=200;
- outside[3].x=530;
- outside[3].y=250;
- outside[4].x=600;
- outside[4].y=350;
- outside[5].x=300;
- outside[5].y=380;
- outside[6].x=100;
- outside[6].y=300;
- inside[0].x=160;
- inside[0].y=180;
- inside[1].x=270;
- inside[1].y=180;
- inside[2].x=300;
- inside[2].y=230;
- inside[3].x=180;
- inside[3].y=270;
- initgraph(&driver,&mode,"H:\TC\BGI");
- setbkcolor(WHITE);
- setcolor(RED);
- //line(outside[0].x,outside[0].y,outside[1].x,outside[1].y);
- for(i=0;i<=6;i++)
- line(outside[i%7].x,outside[i%7].y,outside[(i+1)%7].x,outside[(i+1)%7].y);
- setfillstyle(SOLID_FILL,RED);
- floodfill(400,300,RED);
- setcolor(WHITE);
- for(i=0;i<=3;i++)
- line(inside[i%4].x,inside[i%4].y,inside[(i+1)%4].x,inside[(i+1)%4].y);
- setfillstyle(SOLID_FILL,WHITE);
- floodfill(200,200,WHITE);
- getch();
- closegraph();
- return 0;
- }