• c语言编程 “画圆” 源程序


    #include
    void main()
    {
    int driver,mode;
    driver=DETECT;
    mode=0;
    initgraph(&driver,&mode,“”);
    setcolor(25);
    line(66,66,88,88);
    lineto(200,200);
    linerel(36,65);
    gainch();
    restorecrtmode();
    }

    #include
    #include 预约义库函数
    void circlePoint(int x,int y) 八分法画圆程序
    {
    circle(320 x20,250 y20,3);
    circle(320 y20,250 x20,3);
    circle(320-y20,250 x20,3);
    circle(320-x20,250 y20,3);
    circle(320-x20,250 y20,3);
    circle(320-x20,250-y20,3);
    circle(320-y20,250-x20,3);
    circle(320 y20,250-x20,3);
    circle(320 x20,250-y20,3);
    }
    void MidBresenhamcircle(int r) * 中点Bresenham算法画圆的程序 *
    {
    int x,y,d;
    x=0;y=r;d=2-r;* 统计初始值 *
    while(x { circlePoint(x,y);* 绘制点(x,y)及其在八分圆中的另外7个对称点 *
    if(d<0) d =2x 3; 依照毛病项d的判断,决意非最大位移方向上是走仍是不走 * else
    { d =2*(x-y) 5;
    y–;
    }
    x ;
    delay(900000);
    } * while *
    }
    main()
    {
    int i,j,r,graphmode,graphdriver;
    detectgraph(&graphdriver,&graphmode);
    initgraph(&graphdriver,&graphmode," “);
    printf(“中点Bresenhamcircle算法画圆的程序\n”);提示信息
    printf(“看重 |r|<=22”);
    printf(”\n输入半径值 r:“);
    scanf(”%d",&r);
    printf(“按随意任性键表现图形…”);
    gainch();
    cleardevice();
    setbkcolor(BLACK);
    for(i=20;i<=620;i =20) 使用双循环画点函数画出表格中的纵坐标
    for(j=20;j<=560;j )
    putpixel(i,j,2);
    for(j=20;j<=560;j =20) 使用双循环画点函数画出表格中的横坐标
    for(i=20;i<=620;i )
    putpixel(i,j,2);
    outtextxy(320,255,“0”);原点坐标
    outtextxy(320-520,255,“-5”);circle(320-520,250,2);横坐标值
    outtextxy(320 520,255,“5”);circle(320 520,250,2);
    outtextxy(320-2020,255,“-20”);circle(320-2020,250,2);
    outtextxy(320 2020,255,“20”);circle(320 2020,250,2);
    outtextxy(320-2520,255,“-25”);circle(320-2520,250,2);
    outtextxy(320 2520,255,“25”);circle(320 2520,250,2);
    outtextxy(320,250-520,“-5”);circle(320,250-520,2);纵坐标值
    outtextxy(320,250 520,“5”);circle(320,250 520,2);
    outtextxy(320,250-2020,“-20”);circle(320,250-2020,2);
    outtextxy(320,250 2020,“20”);circle(320,250 2020,2);
    outtextxy(20,20,“The center of the circle is (0,0) “);坐标轴左上角表现提示信息 setcolor(RED);标记坐标轴
    line(20,250,620,250);outtextxy(320 2520,230,“X”);
    line(320,20,320,560);outtextxy(330,20,“Y”);
    setcolor(YELLOW);
    MidBresenhamcircle(r);
    setcolor(BLUE);绘制圆
    circle(320,250,r
    20);
    setcolor(2);
    gainch();
    closegraph();
    }
    --------------------------------------------------------#include
    void main()
    {
    int driver,mode;
    driver=DETECT;
    mode=0;
    initgraph(&driver,&mode,””);
    setcolor(25);
    circle(20,20,20);
    gainch();
    }

  • 相关阅读:
    从零开始搭建Electron项目之运行例程
    Android查看公钥与MD5
    Elasticsearch搜索引擎
    sql注入(其他)
    Linux下的常见指令及权限理解(上)
    Python1-Pillow库简单使用
    “轻松实现文件复制备份,自动编号轻松管理
    failed to req API:/nacos/v1/ns/instance after all servers([localhost:8848])
    Apache Druid 数据摄取---本地数据和kafka流式数据
    类继承关系梳理
  • 原文地址:https://blog.csdn.net/zxbyzx/article/details/128036112