home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / EXAMPLES.ZIP / INTRO16.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  808 b   |  31 lines

  1. /* INTRO16.C--Example from Chapter 4 of Getting Started */
  2.  
  3. #include <conio.h>
  4. #include <ctype.h>
  5. #include <stdio.h>
  6.  
  7. int main()
  8. {
  9.    char cmd;
  10.  
  11.    do {
  12.       printf("Chart desired: Pie  Bar  Scatter  Line  Three-D  Exit");
  13.       printf("\nPress first letter of the chart you want: ");
  14.       cmd = toupper(getch());
  15.       printf("\n");
  16.  
  17.       switch (cmd)
  18.       {
  19.          case 'P': printf("Doing pie chart\n"); break;
  20.          case 'B': printf("Doing bar chart\n"); break;
  21.          case 'S': printf("Doing scatter chart\n"); break;
  22.          case 'L': printf("Doing line chart\n"); break;
  23.          case 'T': printf("Doing 3-D chart\n"); break;
  24.          case 'E': break;
  25.          default : printf("Invalid choice. Try again\n");
  26.       }
  27.    } while (cmd != 'E');
  28.  
  29.    return 0;
  30. }
  31.