/******************************************************************************
Curve Tracing - CoSine Curve
*******************************************************************************/
#include <stdio.h>
#include <graphics.h>
#include <math.h>
void main()
{
int r;
int gd = DETECT ,gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
// Initialize variables
int x, y;
float pi = 3.14159265358979323846;
// Draw the x-axis
line(0, getmaxy() / 2, getmaxx(), getmaxy() / 2);
// Draw the sine wave
for (x = 0; x <= getmaxx(); x++) {
// Calculate the y-coordinate of the sine wave
y = getmaxy() / 2 - 50 * cos(x * pi / 180);
// Plot the point
putpixel(x, y, WHITE);
}
}