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

  • 相关阅读:
    spring学习笔记-IOC,AOP,事务管理
    SlicerPro超级切片家具建模插件使用教程
    有哪些适合程序员做的副业?
    使用yolov7训练用labelme标注的数据集
    批量剪辑新技巧:如何提取视频第一帧作为封面图片?
    力扣 1422. 分割字符串的最大得分
    wpf的GridSplitter使用
    C++ PCL点云局部颜色变换
    Pyside6 QFile
    linux系统查看bash的history
  • 原文地址:https://blog.csdn.net/zxbyzx/article/details/128036112