home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / libs / plotlib.lha / Plot_2.lzh / Examples / bsp4.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-08  |  1007 b   |  59 lines

  1. #include <stdio.h>
  2. #include <plot/plotlib.h>
  3.  
  4. DATA sin();
  5. DATA cos();
  6.  
  7. main()
  8. {
  9.     int erfolg,sinid,cosid;
  10.     char a;
  11.  
  12.     erfolg = open_plot();
  13.     if (!erfolg)
  14.     {
  15.         dis_ploterror();
  16.         exit(5);
  17.     }
  18.  
  19.     sinid = get_data(sin,-4.0,4.0,300);
  20.     if (!sinid)
  21.         dis_ploterror();
  22.     cosid = get_data(cos,-4.0,4.0,300);
  23.     if (!cosid)
  24.         dis_ploterror();
  25.  
  26.     if (sinid && cosid)
  27.     {
  28.         erfolg = set_axisname(XAXIS,"Kreisfrequenz");
  29.         if (!erfolg)
  30.             dis_ploterror();
  31.         erfolg = set_axisname(YAXIS,"Amplitude");
  32.         if (!erfolg)
  33.             dis_ploterror();
  34.         erfolg = set_titel("Beispiel 4");
  35.         if (!erfolg)
  36.             dis_ploterror();
  37.         erfolg = set_curvename(sinid,"y = sin(x)");
  38.         if (!erfolg)
  39.             dis_ploterror();
  40.         erfolg = set_curvename(cosid,"y = cos(x)");
  41.         if (!erfolg)
  42.             dis_ploterror();
  43.         erfolg = display(SCREENOUT,GRAPHNOTSET);
  44.         if (!erfolg)
  45.             dis_ploterror();
  46.         else
  47.         {
  48.             a = getchar();
  49.             erfolg  = display(SCREENCLOSE,NULL);
  50.             if (!erfolg)
  51.                 dis_ploterror();
  52.         }
  53.     }
  54.     erfolg = close_plot();
  55.     if (!erfolg)
  56.         dis_ploterror();
  57.     exit(0);
  58. }
  59.