#include <math.h>
#include <chplot.h>

int main() {
    double x[30], y[30], z[900];
    double levels[6];
    double r;
    int datasetnum =0, i, j;
    class CPlot plot;

    linspace(x, -10, 10);
    linspace(y, -10, 10);
    linspace(levels, -0.2, 0.8);
    for(i=0; i<30; i++) {
        for(j=0; j<30; j++) {
            r = sqrt(x[i]*x[i]+y[j]*y[j]);
            z[30*i+j] = sin(r)/r;
        }
    }
    plot.data3D(x, y, z);
    plot.plotType(PLOT_PLOTTYPE_LINES, datasetnum);
    plot.contourLabel(PLOT_ON);
    plot.contourMode(PLOT_CONTOUR_BASE);
    plot.contourLevels(levels);
    plot.plotting();
}