Home Docs
Graphics.h Documentation
Compiler

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 coordinates
  • stangle, endangle: angle range in degrees
  • xradius: horizontal radius
  • yradius: 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;
}

Click Run (DOS) to test this quickly.

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().