/* a plot is created in plot.gif */ #include <math.h> #include <chplot.h> int main() { int numpoints = 36; array double x[numpoints], y[numpoints]; string_t title="Sine Wave", // Define labels. xlabel="Degrees", ylabel="Amplitude"; class CPlot plot; linspace(x, 0, 360); y = sin(x*M_PI/180); // Y-axis data. plot.title(title); plot.label(PLOT_AXIS_X, xlabel); plot.label(PLOT_AXIS_Y, ylabel); plot.data2D(x, y); plot.outputType(PLOT_OUTPUTTYPE_FILE, "gif", "plot.gif"); plot.plotting(); }