C Program to Draw Eclipse using Graphics Function.
⦁ InitGraph initializes the graphics system by loading a graphics driver from disk then putting the system into graphics mode
⦁ The declaration for ellipse function is as follows:
void ellipse(int xcenter, int ycenter, int startAngle, int endAngle, int xRadius, int yRadius);
xcenter - X coordinate of center of eclipse.
ycenter - Y coordinate of center of eclipse.
startAngle - Start angle of the eclipse arc.
endAngle - End angle of the eclipse arc.
xRadius - Horizontal radius of the eclipse.
yRadius - Vertical radius of the eclipse.
⦁ closegraph( ) function switches back the screen from graphics mode to text mode.
--------------------------------------------------------------------------------------------------------------------------
#include<graphics.h>
#include<conio.h>
main( )
{
int gd = DETECT,gm;
initgraph(&gd, &gm, "c:\\tc\\bgi");
eclipse(100,100,0,360,50,25);
getch( );
closegraph( );
return 0;
}
--------------------------------------------------------------------------------------------------------------------------
Output
--------------------------------------------------------------------------------------------------------------------------
Displays Eclipse
EmoticonEmoticon