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 / PLOTEMP1.C < prev    next >
C/C++ Source or Header  |  1992-02-18  |  2KB  |  93 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. /* PLOTEMP1.C--Example from Getting Started */
  4.  
  5. /* This program creates a table and a bar chart plot from a
  6.    set of temperature readings */
  7.  
  8. #include <conio.h>
  9. #include <ctype.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12.  
  13. /* Prototypes */
  14.  
  15. void get_temps(void);
  16. void table_view(void);
  17. void min_max(void);
  18. void avg_temp(void);
  19. void graph_view(void);
  20. void save_temps(void);
  21. void read_temps(void);
  22.  
  23. /* Global defines */
  24.  
  25. #define TRUE      1
  26. #define READINGS  8
  27.  
  28. /* Global data structures */
  29.  
  30. int temps[READINGS];
  31.  
  32. int main(void)
  33. {
  34.    while (TRUE)
  35.    {
  36.       printf("\nTemperature Plotting Program Menu\n");
  37.       printf("\tE - Enter temperatures for scratchpad\n");
  38.       printf("\tS - Store scratchpad to disk\n");
  39.       printf("\tR - Read disk file to scratchpad\n");
  40.       printf("\tT - Table view of current data\n");
  41.       printf("\tG - Graph view of current data\n");
  42.       printf("\tX - Exit the program\n");
  43.       printf("\nPress one of the above keys: ")
  44.  
  45.       switch   (toupper(getche()))
  46.       {
  47.          case 'E': get_temps();  break;
  48.          case 'S': save_temps(); break;
  49.          case 'R': read_temps(); break;
  50.          case 'T': table_view(); break;
  51.          case 'G': graph_view();
  52.          case 'X': exit(0);
  53.       }
  54.    }
  55. }
  56.  
  57. /* Function definitions */
  58.  
  59. void get_temps(void)
  60. {
  61.    printf("\nExecuting get_temps().\n");
  62. }
  63.  
  64. void table_view(void)
  65. {
  66.    printf("\nExecuting table_view().\n");
  67. }
  68.  
  69. void min_max(void)
  70. {
  71.    printf("\nExecuting min_max().\n");
  72. }
  73.  
  74. void avg_temp(void)
  75. {
  76.    printf("\nExecuting avg_temp().\n");
  77. }
  78.  
  79. void graph_view(void)
  80. {
  81.    printf("\nExecuting graph_view().\n");
  82. }
  83.  
  84. void save_temps(void)
  85. {
  86.    printf("\nExecuting save_temps().\n");
  87. }
  88.  
  89. void read_temps(void)
  90. {
  91.    printf("\nExecuting read_temps().\n");
  92. }
  93.