9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia02/ex10.c (717B)
   1 #include <stdio.h>
   2 
   3 
   4 #define TM "3M Corporation"
   5 #define MAXWELL "Maxwell Corporation"
   6 #define SONY "Sony Corporation"
   7 #define VERBATIM "Verbatim Corporation"
   8 
   9 typedef enum {
  10     TM_CORPORATION,
  11     MAXWELL_CORPORATION,
  12     SONY_CORPORATION,
  13     VERBATIM_CORPORATION
  14 } manufacturer_t;
  15 
  16 
  17 int main(void) {
  18     manufacturer_t c;
  19     printf("Introduzca un Id. de fabricante: ");
  20     c = (getchar() - '0');
  21     switch(c) {
  22         case TM_CORPORATION:
  23             printf(TM"\n");
  24             break;
  25         case MAXWELL_CORPORATION:
  26             printf(MAXWELL"\n");
  27             break;
  28         case SONY_CORPORATION:
  29             printf(SONY"\n");
  30             break;
  31         case VERBATIM_CORPORATION:
  32             printf(VERBATIM"\n");
  33             break;
  34         default:
  35             printf("El numero ingresado no es valido\n");
  36             return 1;
  37     }
  38     return 0;
  39 }