资源描述:
《利用win-tc画图》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、肾脏图案:#include#include#definePI3.1415926main(){intx,y,r,r1;doublea;intgdriver=9,gmode=2;initgraph(&gdriver,&gmode,"d:\tc");printf("inputradus(<150)");scanf("%d",&r);cleardevice();setbkcolor(MAGENTA);setcolor(WHITE);for(a=0;a<2*PI;a+=PI/27){x=r*cos(a)+320;y=r*sin(a)+240;r1=a
2、bs(x-320);circle(x,y,r1);}getch();closegraph();}纯手工画线:#include#includemain(){floatt;intx0=320,y0=240;intn,i,j,r,x[50],y[50];intgdriver=DETECT,gmode;n=25,r=111;initgraph(&gdriver,&gmode,"c:\tc");cleardevice();setbkcolor(9);setcolor(4);t=6.28318/n;for(i=0;i<=n;i++){x[i]=r*cos(
3、i*t)+x0;y[i]=r*sin(i*t)+y0;}for(i=0;i<=n-2;i++){for(j=i+1;j<=n-1;j++)line(x[i],y[i],x[j],y[j]);}getch();closegraph();}楼梯:#include#includevoidtria(xa,ya,xb,yb,xc,yc,n)intxa,ya,xb,yb,xc,yc,n;{ intxp,yp,xq,yq,xr,yr; if(n>0) {xp=(xa+xb)/2;yp=(ya+yb)/2; xq=(xb+xc)/2;yq=(yb+yc)/2
4、; xr=(xc+xa)/2;yr=(yc+ya)/2; moveto(xp,yp);lineto(xq,yq); lineto(xr,yr);lineto(xp,yp); tria(xa,ya,xp,yp,xr,yr,n-1); tria(xb,yb,xq,yq,xp,yp,n-1); tria(xc,yc,xr,yr,xq,yq,n-1);}}main(){ intn,xa=10,ya=10,xb=10,yb=470,xc=630,yc=470; intgdriver=DETECT,gmode; printf("Inputrecursiondepth(forexampl
5、e,7):"); scanf("%d",&n); initgraph(&gdriver,&gmode,"d:\tc"); cleardevice(); setbkcolor(9);setcolor(4); moveto(xa,ya);lineto(xb,yb); lineto(xc,yc);lineto(xa,ya); tria(xa,ya,xb,yb,xc,yc,n); getch();closegraph();}渔网程序:#includemain(){intx,y,x1,y1,x0=320,y0=50;inti,j,n=5,r=20;intgdriver=
6、VGA,gmode=VGAHI;initgraph(&gdriver,&gmode,"c:\tc");cleardevice();setbkcolor(9);for(i=0;i<=2*n;i++){x1=x0-i*r;y1=y0+i*r;for(j=0;j<=n-1;j++){x=x1+2*j*r;y=y1+2*j*r;arc(x,y,180,270,r);arc(x,y+2*r,0,90,r);}}x1=x0-2*r;y1=y0;for(i=0;i<=2*n;i++){x1=x1+r;y1=y1+r;for(j=0;j<=n-1;j++){x=x1-2*j*r;y=y1+2*j*r
7、;arc(x,y,90,180,r);arc(x-2*r,y,270,360,r);}}getch();closegraph();}心脏(不出图案)#include#include#definePI3.1415926main(){intx,y,y1,r,r1;doublea;intgdriver=DETECT,gmode;initgraph(&gdriver,&gmode,"d:\tc");printf