C program to draw ellipse using trigonometric method
#include<stdio.h> #include<conio.h> #include<graphics.h> void main() { int gd=DETECT, gm, p1, q1, angle1, angle2, xr, yr; initgraph(&gd, &gm, "C:\\TC\\BGI"); printf("Enter the centre coordinate(p1, q1):"); scanf("%d%d", &p1, &q1); printf("Enter the semi-major axis:"); scanf("%d", &xr); printf("Enter the semi-minor axis:"); scanf("%d", &yr); angle1=0; angle2=360; setcolor(BROWN); ellipse(p1,q1,angle1,angle2,xr,yr); setfillstyle(LTBKSLASH_FILL, MAGENTA); floodfill(p1, q1, BROWN); outtextxy(20, 450, "Press any key to continue..."); getch(); closegraph(); }
Output: