Basic Shapes
ellipse() in graphics.h
ellipse() draws an elliptical arc. It lets you control both X and Y radii, making it useful for stretched circles and oval shapes.
On This Page
Syntax
void ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);
Draws an ellipse segment around center (x, y) between given start/end angles.
Parameters
x, y: center coordinatesstangle, endangle: angle range in degreesxradius: horizontal radiusyradius: vertical radius
ellipse(250, 220, 0, 360, 140, 80);
Full Program
#include <graphics.h>
#include <conio.h>
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
ellipse(250, 220, 0, 360, 140, 80);
ellipse(250, 220, 0, 180, 100, 50);
getch();
closegraph();
return 0;
}
Common Mistakes
- Using
stangle/endangle - Confusing ellipse with circle (circle has only one radius).
- Using extremely large radii that clip outside the screen.
Next: pieslice() and sector().