9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia02/ex18.c (1799B)
   1 #include <stdio.h>
   2 
   3 #define LANGUAGE GER    //    Define language in which month are displyed ESP,GER,ENG
   4 
   5 #if LANGUAGE == ESP
   6     #define JANUARY        "ENERO"
   7     #define FEBRUARY    "FEBRERO"
   8     #define MARCH         "MARZO"
   9     #define APRIL        "ABRIL"
  10     #define MAYO        "MAYO"
  11     #define JUNE        "JUNIO"
  12     #define JULY        "JULIO"
  13     #define AUGUST        "AGOSTO"
  14     #define SEPTEMBER    "SEPTIEMBRE"
  15     #define OCTOBER        "OCTUBRE"
  16     #define NOVEMBER    "NOVIEMBRE"
  17     #define DECEMBER    "DICIEMBRE"
  18 #elif LANGUAGE == GER 
  19     #define JANUARY        "JANUAR"
  20     #define FEBRUARY    "FEBRUAR"
  21     #define MARCH         "MÄRZ"
  22     #define APRIL        "APRIL"
  23     #define MAYO        "MAI"
  24     #define JUNE        "JUNI"
  25     #define JULY        "JULI"
  26     #define AUGUST        "AUGUST"
  27     #define SEPTEMBER    "SEPTEMBER"
  28     #define OCTOBER        "OKTOBER"
  29     #define NOVEMBER    "NOVEMBER"
  30     #define DECEMBER    "DEZEMBER"
  31 #else 
  32     #define JANUARY        "JANUARY"
  33     #define FEBRUARY    "FEBRUARY"
  34     #define MARCH         "MARCH"
  35     #define APRIL        "ABPRIL"
  36     #define MAYO        "MAY"
  37     #define JUNE        "JUNE"
  38     #define JULY        "JULY"
  39     #define AUGUST        "AUGUST"
  40     #define SEPTEMBER    "SEPTEMBER"
  41     #define OCTOBER        "OCTOBER"
  42     #define NOVEMBER    "NOVEMBER"
  43     #define DECEMBER    "DECEMBER"
  44 #endif
  45 
  46 typedef enum {
  47     JAN, FEB, MAR, APR, MAY, JUN, JUL, AGO, SEP, OCT, NOV, DEC
  48 } mes_t;
  49 
  50 int main(void) {
  51     mes_t mes = MAR;
  52     switch(mes)
  53     {
  54         case JAN:
  55             printf(JANUARY"\n");
  56             break;
  57         case FEB:
  58             printf(FEBRUARY"\n");
  59             break;
  60         case MAR:
  61             printf(MARCH"\n");
  62             break;
  63         case APR:
  64             printf(APRIL"\n");
  65             break;
  66         case MAY:
  67             printf(MAYO"\n");
  68             break;
  69         case JUN:
  70             printf(JUNE"\n");
  71             break;
  72         case JUL:
  73             printf(JULY"\n");
  74             break;
  75         case AGO:
  76             printf(AUGUST"\n");
  77             break;
  78         case SEP:
  79             printf(SEPTEMBER"\n");
  80             break;
  81         case OCT:
  82             printf(OCTOBER"\n");
  83             break;
  84         case NOV:
  85             printf(NOVEMBER"\n");
  86             break;
  87         case DEC:
  88             printf(DECEMBER"\n");
  89             break;
  90     }    
  91     return 0;
  92 }