home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / SNIP9404.ZIP / SPIN.C < prev    next >
C/C++ Source or Header  |  1994-04-03  |  867b  |  30 lines

  1. /*
  2. **  Miscellaneous text spinners demonstration
  3. **
  4. **  public domain by Jon Guthrie, Bob Stout, and others
  5. */
  6.  
  7. #include <stdio.h>
  8.  
  9. #define DURATION 500    /* Length of demo       */
  10. #define SSLOWDOWN 5     /* Make spinner look ok */
  11. #define TSLOWDOWN 10    /* Make target look ok  */
  12.  
  13. main()
  14. {
  15.       unsigned i;
  16.       char spinner[] = "|/-\\", target[] = ".oO";
  17.  
  18.       for (i = 0; i < DURATION; ++i)
  19.       {
  20.             unsigned scount = i / SSLOWDOWN, tcount = i / TSLOWDOWN;
  21.             unsigned scountdown  = DURATION / SSLOWDOWN;
  22.             unsigned tcountdown  = DURATION / TSLOWDOWN;
  23.  
  24.             printf("CW %c ... CCW %c ... Explode %c ... Implode%c\r",
  25.                   spinner[scount & 3], spinner[(scountdown - scount) & 3],
  26.                   target[tcount % 3], target[(tcountdown - tcount) % 3]);
  27.       }
  28.       return 0;
  29. }
  30.