⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d.c

📁 包括很多的花卉程序
💻 C
字号:
#include<graphics.h>
#include<math.h>
void polygon();

main()
{
  int i,a,x,y;
  float af;
  int gdriver=DETECT,gmode;
  printf("input length of polygon:a=");
  scanf("%d",&a);
  printf("\ninput position point:\nx=");
  scanf("%d",&x);
  printf("y=");
  scanf("%d",&y);
  printf("\ninput angle of polygon:af=");
  scanf("%f",&af);
  initgraph(&gdriver,&gmode,"c:\\tc");
  cleardevice();
  setbkcolor(9);setcolor(4);
  for(i=3;i<=10;i++)
  polygon(x,y,a,i,af);
  getch();
  closegraph();
}

void polygon(int x0,int y0,int a,int n,float  af)
                   
{
   int x,y,i;
   float dtheta,theta;
   if(n<3) return;
   dtheta=6.28314/n;
   theta=af*0.0174533;
   moveto(x0,y0);
   x=x0;y=y0;
   for(i=1;i<n;i++) {
    x=x+a*cos(theta); y=y+a*sin(theta);
    lineto(x,y); theta+=dtheta;
  }
 lineto(x0,y0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -