home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / lib_term / examp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  2.0 KB  |  93 lines

  1. #include <stdio.h>
  2. #include <term.h>
  3.  
  4. main()
  5.  
  6. {
  7.     int num1, num2;
  8.     float fnum1, fnum2;
  9.     char HospNum[9];
  10.     char text[20];
  11.     static char *table[] =
  12.     {
  13.     "Number one",
  14.     "Number two",
  15.     "And even yet another",
  16.     "two turtle moves",
  17.     "a partridge in a directory tree"
  18.     };
  19.  
  20.  
  21.     if(InitTerm() != 0)
  22.     printf("InitTerm failed\n");
  23.     page();
  24.  
  25.     printf("Here are your choices -->");
  26.     num1 = PickOne(table, 5);
  27.     printf("<--\nNumber %d was chosen\n", num1);
  28.  
  29.     printf("Here are your choices -->");
  30.     num1 = PickOne(table, 1);
  31.     printf("<--\nNumber %d was chosen\n", num1);
  32.  
  33.     printf("Enter a string -->");
  34.     GetString(text, 15, 0);
  35.     printf("<--\nString is %s\n", text);
  36.  
  37.     printf("yes or no ? -->");
  38.     num1 = GetBool(1);
  39.     printf(",");
  40.     num2 = GetBool(num1);
  41.     printf("<---\n");
  42.     printf("Booleans are %d, %d\n", num1, num2);
  43.  
  44.     printf("Enter a number --->");
  45.     num1 = GetInt(50, 4);
  46.     printf(",");
  47.     num2 = GetInt(num1, 6);
  48.     printf("<---\n");
  49.     printf("Numbers were %d, %d\n", num1, num2);
  50.  
  51.     printf("Enter a number --->");
  52.     fnum1 = GetFloat(50.0, 8, 5);
  53.     printf(",");
  54.     fnum2 = GetFloat(fnum1, 6, 2);
  55.     printf("<---\n");
  56.     printf("Numbers were %f, %f\n", fnum1, fnum2);
  57.  
  58.     printf("Enter hospital number --->");
  59.     GetHospNum(HospNum);
  60.     printf("<---\n");
  61.     printf("Number is %s\n", HospNum);
  62.  
  63.     fflush(stdout);
  64.     sleep(2);
  65.  
  66.     page();
  67.     num1 = MenuPick("This is a demo of MenuPick", table, 5);
  68.     printf("<--\nNumber %d was chosen\n", num1);
  69.     sleep(2);
  70.  
  71.  
  72.     page();
  73.     gotoxy(15, 15);
  74.     center(1, "I am normal text centered on line 1", 0);
  75.     center(10, "I am underlined text centered on line 10", 1);
  76.     center(20, "I am standout text centered on line 20", 2);
  77.     gotoxy(1, 1);
  78.     printf("+");
  79.     gotoxy(80, 1);
  80.     printf("+");
  81.     gotoxy(40, 12);
  82.     printf("+");
  83.     gotoxy(1, 24);
  84.     printf("+");
  85.     gotoxy(79, 24);
  86.     printf("+");
  87.     fflush(stdout);
  88.  
  89.     sleep(2);
  90.     gotoxy(1, 24);
  91.     exit(0);
  92. }
  93.