Professional Documents
Culture Documents
Ashton Hughey
/* File: linea.ch
Plot the linear relation y = 2*x-5 for x from -10 to 10. */
#include <chplot.h> /* for CPlot */
plot.mathCoord();
plot.title("");
plot.label(PLOT_AXIS_X, "x");
plot.label(PLOT_AXIS_Y, "y");
/* add a line connecting (x1, y1) and (x2, y2) to the plot */
x1 = -10;
y1 = 3*x1+10;
x2 = 10;
y2 = 3*x2+10;
plot.line(x1, y1, x2, y2);
plot.plotting();