zoukankan      html  css  js  c++  java
  • DDA画直线

    #include "stdio.h"                          //用DDA法画直线,定义了直线始点(10,10*m+30)
    #include <graphics.h>
    main()
    {   float m;
     printf("the m is ");                //输入直线的斜率m
     scanf("%f",&m);
     
     if(abs(m)<=1)                      
     {
     int x;
        float y;
        int driver=DETECT,mode;
        initgraph(&driver,&mode,"c:\WINLibTC");
        y=10*m+30;
        for(x=10;x<=300;x++)
       {
         y=y+m;
        putpixel(x,y,4);
       }
       getch();
       closegraph(); 
       } 

       else
       {
         int y;
         float x;
        int driver=DETECT,mode;
        initgraph(&driver,&mode,"c\WINLibTC");
     
        for(y=10;y<=300;y++)
       {
         x=x+1/m;
        putpixel(x,y,4);
       }
       getch();
       closegraph();  
        
         }

    }

  • 相关阅读:
    docker安装部署命令
    kubernetes原理
    kubernetes安装部署
    Ansible安装
    模拟红绿灯(递归与队列)
    数据结构——顺序表
    数据结构——基本概念
    C语言高级编程
    Shell编程
    Shell命令
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/1964225.html
Copyright © 2011-2022 走看看