home *** CD-ROM | disk | FTP | other *** search
/ MS DOS Archives 1 / MS-DOS_Archives_Volume_One_Walnut_Creek.iso / msdos / graphics / hgrph101.arc / DEMO.C < prev    next >
C/C++ Source or Header  |  1989-02-25  |  2KB  |  62 lines

  1.  
  2.  
  3.  
  4.  /* DEMO.C - a demo of hgraph.lib's string writing routines */
  5.  
  6.  #include <string.h>               /* for strlen() */
  7.  #include <stdlib.h>               /* for gcvt() */
  8.  #include <conio.h>                /* for getch() */
  9.  #include "hgraph.h"               /* for the hgraph routines */
  10.  
  11.  
  12.  char buffer[80];                               /* for use with gcvt() */
  13.  
  14.  main()
  15.  {
  16.  int ct, i;
  17.  char c, *strp;
  18.  char *string = "HGRAPH.LIB";
  19.  double pi = 3.141592654;
  20.  
  21.          hgraph_init();
  22.          HGPAGE = 1;
  23.          ct = strlen(string);
  24.          strp = string;
  25.          hgmode_nc();
  26.          hclearpg();
  27.          hshowpg();
  28.  
  29.  
  30.       hstr(40, 1, string, HGINVS, ct);             /* accross */
  31.       for(i = 0; i < ct; i++) {
  32.            hstr(50, 2 + i, strp, HGINVS, 1);       /* down */
  33.            hstr(49 - i, 12, strp, HGINVS, 1);      /* back */
  34.            hstr(39, 11 - i, strp, HGINVS, 1);      /* up   */
  35.            strp++;
  36.       }
  37.  
  38.             /* double line box */
  39.       hbox(1, 72, 152, 400, 192);
  40.       hbox(1, 68, 150, 404, 194);
  41.  
  42.              /* text for in box */
  43.  
  44.       HGATRB = HGNORM;
  45.       hwrite(20, 10, "You can write UPPER or lower case");
  46.       hwrite(22, 10, "Numbers");
  47.       gcvt( -pi, 10, buffer);
  48.       hwrite(22, 20, buffer);
  49.  
  50.              /* rest of screen */
  51.  
  52.       HGATRB = HGINVS;
  53.       hwrite(30, 10, "Or graphics (see COP.C)");
  54.  
  55.  
  56.       HGATRB = HGNORM;
  57.       hwrite(40, 10, "Press any key to continue ...");
  58.           getch();
  59.       htmode_nc();
  60.  }
  61.  
  62.