home *** CD-ROM | disk | FTP | other *** search
/ Light / Light_Vol.1_June_1992_Datasphere_Publications_Disk_1_of_2_Side_A.d64 / c-menu.c < prev    next >
Text File  |  2023-02-26  |  2KB  |  56 lines

  1. /*
  2.  
  3.    Menu Program  - Chapter 1
  4.  
  5.    note: This  listing is slightly different to that in the
  6.          accompanying text.  I  have  accomodated 40 and 80
  7.          column screen displays with the help of the is80()
  8.          function.
  9.  
  10. */
  11.  
  12. #include "stdio.h"
  13. #include "ctype.h"
  14.  
  15. #define clear_screen printf("\223")
  16.  
  17. main()
  18. {SHIFT-+}
  19.    char choice,temp;
  20.    int column;
  21.  
  22.    if (is80())                            /* C64 users remove the is80()   */
  23.        column = 25;                       /* if else statement and replace */
  24.    else                                   /* with column = 10;             */
  25.        column = 10;
  26.  
  27.  
  28.        while (choice != 'Q')
  29.        {SHIFT-+}
  30.            clear_screen;
  31.            cursor(3,column+8);printf("MENU");
  32.            cursor(6,column);printf("1. Variables");
  33.            cursor(8,column);printf("2. Functions");
  34.            cursor(10,column);printf("3. Arrays & Pointers");
  35.            cursor(12,column);printf("4. Files");
  36.            cursor(14,column);printf("Q. Quit");
  37.            cursor(20,column+1);printf("Enter Choice (1-4) or Q: ");
  38.  
  39.            temp = getchar();
  40.            choice = toupper(temp);
  41.  
  42.  
  43.  
  44.            switch(choice) {SHIFT-+}
  45.  
  46.                case '1' : putchar(choice); exec("variables"); break;
  47.                case '2' : putchar(choice); exec("functions"); break;
  48.                case '3' : putchar(choice); exec("arrays"); break;
  49.                case '4' : putchar(choice); exec("files"); break;
  50.                case 'Q' : cursor(22,column+2);printf("Quit!...press a key");
  51.                           {SHIFT--}
  52.        {SHIFT--}
  53.        getchar();
  54.  
  55. {SHIFT--}
  56.  
  57.