Ellipse in c/c++ graphics
ellipse() :
It is used to draw elliptical arc in the current color.
Syntax :
ellipse(int x,int y,int stangle,int endangle,int xradius,int yradius);
xradius---Horizontal axis
yradius---Vertical axis
Note : There are two types of ellipse :
- Major x-axis ellipse : If the x radius is greater then y radius.
- Minor y-axis ellipse : If the x radius is less then y radius.
So if the argument xradius value is great than the yradius value than major x-axis ellipse
is formed and vice versa.
Example :
#include <graphics.h>
#include <conio.h>
void main()
{
int d,m;
int sangle=0,endangle=360,xradius=200,yradius=40;
int midx,midy;
d=DETECT;
initgraph(&d,&m,"c:\\tc\\bgi");
midx=getmaxx()/2;
midy=getmaxy()/2;
ellipse(midx,midy,sangle,endangle,xradius,yradius);
getch();
closegraph;
}
Output :
0 comments:
Post a Comment