home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 253_01 / enum.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-15  |  744 b   |  39 lines

  1.                                          /* Chapter 6 - Program 3 */
  2. #include "stdio.h"
  3.  
  4. void main()
  5. {
  6. enum {win,tie,bye,lose,no_show} result;
  7. enum {sun,mon,tues,wed,thur,fri,sat} days;
  8.  
  9.    result = win;
  10.    printf("    win = %d\n",result);
  11.    result = lose;
  12.    printf("   lose = %d\n",result);
  13.    result = tie;
  14.    printf("    tie = %d\n",result);
  15.    result = bye;
  16.    printf("    bye = %d\n",result);
  17.    result = no_show;
  18.    printf("no show = %d\n\n",result);
  19.  
  20.    for(days = mon;days < fri;days++)
  21.       printf("The day code is %d\n",days);
  22. }
  23.  
  24.  
  25.  
  26. /* Result of execution
  27.     win = 0
  28.    lose = 3
  29.     tie = 1
  30.     bye = 2
  31. no show = 4
  32.  
  33. The day code is 1
  34. The day code is 2
  35. The day code is 3
  36. The day code is 4
  37.  
  38. */
  39.