232 Introduction to C++ Programming and Graphics
float xd[n], yd[n]; // data points
float t=0.; // time
float Dt=0.05; // time step
for (int i=0; i<n; i++)
{
xd[i]=(i-1.0)/n; // abscissas
}
//--- Plotting parameters:
float xmin=0.0, xmax=1.0; // plotting limits
float ymin=0.0, ymax=1.0;
int ntcx =10; // number of ticks on the x axis
int ntcy =10; // number of ticks on the y axis
int Ilabelax =1; // 1 to label axes; 0 for no labels
int axc = BLACK; // axis color
int lbc = RED; // plot label color
char labelx[] = "x"; // x-axis label
char labely[] = "y"; // y-axis label
char title1[] =" "; // // first plot label
char title2[] =" "; // // second plot label
char title3[] =" ";// // third plot label
//--- Graphics:
float xmarg = 0.2*(xmax-xmin); // plotting margin
float ymarg = 0.2*(ymax-ymin);
int Icheck;
again:
prefposition (500,100);
prefsize (500,500);
vinit ("X11");
backbuffer();
short Itry = 0;
short Iplot = 0;
repeat:
ortho2 (xmin-xmarg,xmax+xmarg,ymin-ymarg,ymax+ymarg);
color (WHITE);
clear();
//--- Repaint the plotting area:
if(Iplot==4 || Iplot==6)