home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 349_01 / sss.arc / EX_0301.C < prev    next >
Text File  |  1991-04-09  |  628b  |  42 lines

  1. /* Program EX_0301.C
  2.    Listing 4C - see documentation in TUTOR.SSS
  3. */
  4.  
  5. #include "SSSC.H"
  6.  
  7. #define free 0
  8. #define busy 1
  9.  
  10. double rnx(double m, double s)
  11. {
  12.   double x;
  13.   do x = RN(m, s);
  14.   while (x <= 0.0);
  15.   return(x);
  16. }
  17.  
  18. void prime(void)
  19. {
  20.   INIQUE(0, 0, 1);
  21.   INISTA(1, "Busy fraction", 1, 0, 0, 0);
  22.   TALLY(1, free);
  23.   SETT(rnx(7, 4));
  24.   TALLY(1, busy);
  25. }
  26.  
  27. main()
  28. {
  29.   prime();
  30.  
  31.   do
  32.   {
  33.     if (RA() < .25) SETT(T()+ER(2, 2));
  34.                else SETT(T()+TR(1, 3, 4));
  35.     TALLY(1, free);
  36.     SETT(T()+rnx(7, 4));
  37.     TALLY(1, busy);
  38.   } while (T() <= 120);
  39.  
  40.   SUMRY("");
  41. }
  42.