home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-3.ZIP / EXAMPLES.ZIP / INTRO16.CPP < prev    next >
C/C++ Source or Header  |  1992-02-18  |  653b  |  30 lines

  1. // INTRO16.CPP--Example from Chapter 3, "An Introduction to C++"
  2.  
  3. #include <conio.h>
  4. #include <iostream.h>
  5. #include <ctype.h>
  6.  
  7. int main()
  8. {
  9.     char cmd;
  10.  
  11.     cout << "Chart desired: Pie  Bar  Scatter  Line  Three-D";
  12.     cout << "\n Press first letter of the chart you want: ";
  13.     cmd = toupper(getch());
  14.     cout << '\n';
  15.  
  16.     if (cmd == 'P')
  17.         cout << "Doing pie chart\n";
  18.     else if (cmd == 'B')
  19.         cout << "Doing bar chart\n";
  20.     else if (cmd == 'S')
  21.         cout << "Doing scatter chart\n";
  22.     else if (cmd == 'L')
  23.         cout << "Doing line chart\n";
  24.     else if (cmd == 'T')
  25.         cout << "Doing 3-D chart\n";
  26.     else cout << "Invalid choice.\n";
  27.  
  28. return 0;
  29. }
  30.