home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progc / learnc.arj / MENU.C < prev    next >
Encoding:
Text File  |  1991-11-10  |  5.7 KB  |  233 lines

  1. /*Turbo Menu copyright (c) HyTech Inc.
  2.   Compiled under Turbo C v2.0
  3. */
  4.  
  5. main(void)
  6. {
  7. char main_ans = 'z';
  8.  
  9. while(main_ans != 'q' && main_ans != 'Q'){  /*break out of loop if one is true*/
  10.  
  11. clrscr(); /* clear screen, Turbo C compiler*/
  12. printf("\n\n\n");
  13. printf("    Please note CONFIG.SYS must have: device=ansi.sys\n\n");
  14. printf("                 ╔═══════════════════════════════╗\n");
  15. printf("                 ║        PONZO TUTOR            ║░\n");
  16. printf("                 ║ ───────────────────────────── ║░\n");
  17. printf("                 ║  Turbo Menu, (c) HyTech Inc.  ║░\n");
  18. printf("                 ║P.O Box 805 Dearborn, MI. 48121║░\n");
  19. printf("                 ║ ──────────────────────────────║░\n");
  20. printf("                 ║ A: Installation Instructions  ║░\n");
  21. printf("                 ║ B: A Great Software offer!!   ║░\n");
  22. printf("                 ║ C: Print an Order Form        ║░\n");
  23. printf("                 ║ D: Lessons Menu               ║░\n");
  24. printf("                 ║ E: Test Menu                  ║░\n");
  25. printf("                 ║ F: View C Code For This Menu  ║░\n");
  26. printf("                 ║ Q: QUIT                       ║░\n");
  27. printf("                 ╚═══════════════════════════════╝░\n");
  28. printf("                   ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n\n");
  29. printf("                    Please Enter Your Selection: ");
  30.  
  31. main_ans = getch();     /*get user input without hitting enter*/
  32.  
  33.  
  34. switch(main_ans){   /*switch is used li an if statement*/
  35.  
  36.    case 'a':
  37.    case 'A':
  38.         install();   /* all called functions are declared as void because */
  39.    break;                   /* they return no values*/
  40.    case 'b': 
  41.    case 'B' :
  42.         offer();
  43.    break;
  44.    case 'c':
  45.    case 'C':
  46.         order_frm();
  47.    break;
  48.    case 'd':
  49.    case 'D':
  50.      lesson_menu();
  51.    break;
  52.    case 'E':
  53.    case 'e':
  54.      test_menu();
  55.    break;
  56.    case 'f':
  57.    case 'F':
  58.        view_code();
  59.    break;
  60.    case 'q':
  61.    case 'Q':
  62.            clrscr();
  63.    break;
  64.     }
  65.   }
  66. }
  67.  
  68. /************************************************************************/
  69. int   /*good habit to declare what type of valus the functions/*
  70.       /*will be using. Always will default to int*/
  71. install(void)
  72. {
  73. system("browse ctutor.doc");
  74. }
  75.  
  76.  
  77. /************************************************************************/
  78. int
  79. offer(void)
  80. {
  81. system("browse offer.dat");
  82.  
  83. }
  84.  
  85.  
  86. /************************************************************************/
  87. int
  88. order_frm(void)
  89. {
  90. system("copy order.frm prn");
  91. }
  92.  
  93.  
  94.  
  95. /************************************************************************/
  96. int
  97. lesson_menu(void)
  98. {
  99. char lesson_ans = 'z';
  100.  
  101. while(lesson_ans != 'q' && lesson_ans != 'Q'){
  102.  
  103. clrscr();
  104. printf("\n\n\n");
  105. printf("                 ╔══════════════════╗\n");
  106. printf("                 ║  C Lessons Menu  ║░\n");
  107. printf("                 ║ ─────────────────║░\n");
  108. printf("                 ║ A: Lesson 1      ║░\n");
  109. printf("                 ║ B: Lesson 2      ║░\n");
  110. printf("                 ║ C: Lesson 3      ║░\n");
  111. printf("                 ║ D: Lesson 4      ║░\n");
  112. printf("                 ║ E: Lesson 5      ║░\n");
  113. printf("                 ║ F: Lesson 6      ║░\n");
  114. printf("                 ║ G: Lesson 7      ║░\n");
  115. printf("                 ║ H: Lesson 8      ║░\n");
  116. printf("                 ║ I: Lesson 9      ║░\n");
  117. printf("                 ║ J: Lesson 10     ║░\n");
  118. printf("                 ║ K: Lesson 11     ║░\n");
  119. printf("                 ║ L: Lesson 12     ║░\n");
  120. printf("                 ║ Q: QUIT          ║░\n");
  121. printf("                 ╚══════════════════╝░\n");
  122. printf("                   ░░░░░░░░░░░░░░░░░░░\n\n");
  123. printf("              Please Enter Your Selection: ");
  124.  
  125. lesson_ans = getch();
  126.  
  127. switch(lesson_ans){
  128.  
  129.    case 'a':
  130.    case 'A':
  131.         system("display lesson1");
  132.    break;
  133.    case 'b':
  134.    case 'B' :
  135.         system("display lesson2");
  136.    break;
  137.    case 'c':
  138.    case 'C':
  139.         system("display lesson3");
  140.    break;
  141.    case 'd':
  142.    case 'D':
  143.          system("display lesson4");
  144.    break;
  145.    case 'E':
  146.    case 'e':
  147.          system("display lesson5");
  148.    break;
  149.    case 'f':
  150.    case 'F':
  151.          system("display lesson6");
  152.    break;
  153.    case 'g':
  154.    case 'G':
  155.          system("display lesson7");
  156.    break;
  157.    case 'h':
  158.    case 'H':
  159.          system("display lesson8");
  160.    break;
  161.    case 'i':
  162.    case 'I':
  163.          system("display lesson9");
  164.    break;
  165.    case 'j':
  166.    case 'J':
  167.         system ("display lesson10");
  168.    break;
  169.    case 'k':
  170.    case 'K':
  171.          system("display lesson11");
  172.    break;
  173.    case 'l':
  174.    case 'L':
  175.          system("display lesson12");
  176.    break;
  177.    case 'q':
  178.    case 'Q':
  179.            clrscr();
  180.    break;
  181.     }
  182.   }
  183. }
  184.  
  185.  
  186. /************************************************************************/
  187. int
  188. test_menu(void)
  189. {
  190.  
  191. char test_ans ='z';
  192.  
  193. while(test_ans != 'q' && test_ans != 'Q'){
  194. clrscr();
  195. printf("\n\n\n\n\n\n\n");
  196. printf("                 ╔══════════════════╗\n");
  197. printf("                 ║   C Test Menu    ║░\n");
  198. printf("                 ║ ─────────────────║░\n");
  199. printf("                 ║ A: Test 1-5      ║░\n");
  200. printf("                 ║ B: Test 6-8      ║░\n");
  201. printf("                 ║ Q: QUIT          ║░\n");
  202. printf("                 ╚══════════════════╝░\n");
  203. printf("                   ░░░░░░░░░░░░░░░░░░░\n\n");
  204. printf("                    Please Enter Your Selection: ");
  205.  
  206. test_ans = getch();
  207.  
  208. switch(test_ans){
  209.  
  210.    case 'a':
  211.    case 'A':
  212.         system("display test1-5");
  213.    break;
  214.    case 'b':
  215.    case 'B' :
  216.         system("display test6-8");
  217.    break;
  218.    case 'q':
  219.    case 'Q':
  220.            clrscr();
  221.    break;
  222.     }
  223.   }
  224. }
  225.  
  226.  
  227. /************************************************************************/
  228. int
  229. view_code(void)
  230. {
  231. system("browse menu.c");
  232. }
  233.