在C图形中画圆

头文件显示图形。h包含 圆圈() 函数,它画一个圆心在(x,y)和给定半径的圆。

null

语法:

circle(x, y, radius);

where,
(x, y) is center of the circle.
'radius' is the Radius of the circle.

例如:

Input : x = 250, y = 200, radius = 50
Output : 图片[1]-在C图形中画圆-yiteyi-C++库

Input : x = 300, y = 150, radius = 90
Output : 图片[2]-在C图形中画圆-yiteyi-C++库

下面是用C绘制圆的实现:

// C Implementation for drawing circle
#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;
// initgraph initializes the
// graphics system by loading a
// graphics driver from disk
initgraph(&gd, &gm, "" );
// circle function
circle(250, 200, 50);
getch();
// closegraph function closes the
// graphics mode and deallocates
// all memory allocated by
// graphics system .
closegraph();
return 0;
}


输出:

图片[3]-在C图形中画圆-yiteyi-C++库
© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享