home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / WGT_TC21.ZIP / WGT04.C < prev    next >
C/C++ Source or Header  |  1992-07-17  |  1KB  |  61 lines

  1. #include <conio.h>
  2. #include "c:\tc\wgt\wgt.h"
  3. /*   WORDUP Graphics Toolkit   Version 2.1
  4.      Demonstration program 4
  5.  
  6. This program has several loops which perform a drawing action
  7. until you press a key.
  8. Loops include line,rectangle,bar,circle and filled circle
  9. */
  10.  
  11. int x,y,col;
  12.  
  13. void main(void)
  14. {
  15. vga256();        // initializes system
  16. do {
  17.    x=rand() % 320;
  18.    y=rand() % 200;
  19.    col=rand() % 255;
  20.    wsetcolor(col);
  21.    wline(rand() % 320,rand() % 200,x,y);     // draw randomly
  22.    } while (kbhit()==0);
  23. getch();        // get the key
  24.    wcls(0);
  25. do {
  26.    x=rand() % 320;
  27.    y=rand() % 200;
  28.    col=rand() % 255;
  29.    wsetcolor(col);
  30.    wrectangle(rand() % 320,rand() % 200,x,y);
  31.    } while (kbhit()==0);
  32. getch();        // get the key
  33.    wcls(0);
  34. do {
  35.    x=rand() % 320;
  36.    y=rand() % 200;
  37.    col=rand() % 255;
  38.    wsetcolor(col);
  39.    wbar(rand() % 320,rand() % 200,x,y);
  40.    } while (kbhit()==0);
  41. getch();        // get the key
  42.    wcls(0);
  43. do {
  44.    x=rand() % 320;
  45.    y=rand() % 200;
  46.    col=rand() % 255;
  47.    wsetcolor(col);
  48.    wcircle(x,y,rand() % 100);
  49.    } while (kbhit()==0);
  50. getch();
  51.    wcls(0);
  52. do {
  53.    x=rand() % 320;
  54.    y=rand() % 200;
  55.    col=rand() % 255;
  56.    wsetcolor(col);
  57.    wfill_circle(x,y,rand() % 100);
  58.    } while (kbhit()==0);
  59. getch();        // get the key
  60. textmode(C80);        // used to return to text mode
  61. }