头文件显示图形。h包含 arc() 函数,它绘制一条中心位于(x,y)且半径给定的圆弧。开始角是角度的起点,结束角是角度的终点。角度的值可以在0到360度之间变化。
null
语法:
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.
例如:
Input : x=250, y=250, start_angle = 155, end_angle = 300, radius = 100 Output :Input : x=250, y=250, start_angle = 0, end_angle = 300, radius = 100; Output :
![]()
下面是arc()函数的实现:
// C implementation of arc function #include <graphics.h> // 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; } |
输出:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END