📜  C中的弧函数

📅  最后修改于: 2021-05-25 21:31:54             🧑  作者: Mango

头文件graphics.h包含arc()函数,该函数绘制中心为(x,y)且给定半径的弧。 start_angle是角度的起点,而end_angle是角度的终点。角度值可以在0到360度之间变化。

句法 :

void arc(int x, int y, int start_angle,
            int end_angle, int radius);

where,
(x, y) is the center of the arc.
start_angle is the starting angle and 
end_angle is the ending angle.
'radius' is the Radius of the arc.

例子 :

输入:x = 250,y = 250,start_angle = 155,end_angle = 300,radius = 100输出: 输入:x = 250,y = 250,start_angle = 0,end_angle = 300,radius = 100;输出 :

下面是arc()函数:

// C implementation of arc function
#include 
  
// driver code
int main()
{
    // gm is Graphics mode which is
    // a computer display mode that
    // generates image using pixels.
    // DETECT is a macro defined in
    // "graphics.h" header file
    int gd = DETECT, gm;
  
    // location of the arc
    int x = 250;
    int y = 250;
  
    // starting angle and ending angle
    // of the arc
    int start_angle = 155;
    int end_angle = 300;
  
    // radius of the arc
    int radius = 100;
  
    // initgraph initializes the graphics system
    // by loading a graphics driver from disk
    initgraph(&gd, &gm, "");
  
    // arc function
    arc(x, y, start_angle, end_angle, radius);
  
    getch();
  
    // closegraph function closes the graphics
    // mode and deallocates all memory allocated
    // by graphics system
    closegraph();
  
    return 0;
}

输出:

想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。