• 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();
    }

  • 相关阅读:
    手机建模教程 | 如何从易模App中导出模型?有哪些格式?含贴图吗?
    JVM:(二)类加载子系统
    73.【JavaWeb-01】
    Redis集群模式和常用数据结构
    c语言数据结构 排序(三)
    Maven是什么? Maven的概念+作用
    Python的加密
    Nacos配置文件更新+热更新+多环境配置共享+集群搭建
    国产API管理工具Eolink太好用了,打造高效的研发利器
    MybatisPlus 1 MybatisPlus 入门案例与简介 1.1 入门案例
  • 原文地址:https://blog.csdn.net/zxbyzx/article/details/128036112