home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / datafiles / text / c_tutor / switch.c < prev    next >
C/C++ Source or Header  |  1995-02-27  |  619b  |  24 lines

  1. main()
  2. {
  3. int truck;
  4.  
  5.    for (truck = 3;truck < 13;truck = truck + 1) {
  6.  
  7.       switch (truck) {
  8.          case 3  : printf("The value is three\n");
  9.                    break;
  10.          case 4  : printf("The value is four\n");
  11.                    break;
  12.          case 5  :
  13.          case 6  :
  14.          case 7  :
  15.          case 8  : printf("The value is between 5 and 8\n");
  16.                    break;
  17.          case 11 : printf("The value is eleven\n");
  18.                    break;
  19.          default : printf("It is one of the undefined values\n");
  20.                    break;
  21.       } /* end of switch */
  22.  
  23.    } /* end of for loop */
  24. }