/******************************************************************************
Curve Tracing - Hyperbola
*******************************************************************************/
#include <stdio.h>
#include <graphics.h>
#include <math.h>
void main()
{
int r;
int gd = DETECT ,gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
int midx, midy;
int a = 200, b = 100;
// Calculate the center of the hyperbola
midx = getmaxx() / 2;
midy = getmaxy() / 2;
// Draw the hyperbola
for (int x = -a; x <= a; x++) {
int y = (b * b) / (a * a) - (x * x);
putpixel(midx + x, midy - y, WHITE);
putpixel(midx + x, midy + y, WHITE);
}
}