c-first-steps

a C playground
Index Commits Files Refs README
commit 01a6c4e17cad4f27dc40b7f3d0484be0e808a715
parent f2a6aaae31f9ca589404042be1ee5217a81dd03e
Author: Martin J. Klockner <martin.cachari@gmail.com>
Date:   Mon, 16 Nov 2020 16:23:09 -0300

Improved ej5.c code by moving the '\n' char inside of printf format insted
of having it on #define

Diffstat:
Mguia02/ej5.c | 48++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/guia02/ej5.c b/guia02/ej5.c
@@ -4,58 +4,58 @@ typedef enum {
     JAN, FEB, MAR, APR, MAY, JUN, JUL, AGO, SEP, OCT, NOV, DEC
 } mes_t;
 
-#define JANUARY        "ENERO\n"
-#define FEBRUARY    "FEBRERO\n"
-#define MARCH         "MARZO\n"
-#define APRIL        "ABRIL\n"
-#define MAYO        "MAYO\n"
-#define JUNE        "JUNIO\n"
-#define JULY        "JULIO\n"
-#define AUGUST        "AGOSTO\n"
-#define SEPTEMBER    "SEPTIEMBRE\n"
-#define OCTOBER        "OCTUBRE\n"
-#define NOVEMBER    "NOVIEMBRE\n"
-#define DECEMBER    "DICIEMBRE\n"
+#define JANUARY        "ENERO"
+#define FEBRUARY    "FEBRERO"
+#define MARCH         "MARZO"
+#define APRIL        "ABRIL"
+#define MAYO        "MAYO"
+#define JUNE        "JUNIO"
+#define JULY        "JULIO"
+#define AUGUST        "AGOSTO"
+#define SEPTEMBER    "SEPTIEMBRE"
+#define OCTOBER        "OCTUBRE"
+#define NOVEMBER    "NOVIEMBRE"
+#define DECEMBER    "DICIEMBRE"
 
 int main(void) {
     mes_t mes = NOV;
     switch(mes)
     {
         case JAN:
-            printf(JANUARY);
+            printf(JANUARY"\n");
             break;
         case FEB:
-            printf(FEBRUARY);
+            printf(FEBRUARY"\n");
             break;
         case MAR:
-            printf(MARCH);
+            printf(MARCH"\n");
             break;
         case APR:
-            printf(APRIL);
+            printf(APRIL"\n");
             break;
         case MAY:
-            printf(MAYO);
+            printf(MAYO"\n");
             break;
         case JUN:
-            printf(JUNE);
+            printf(JUNE"\n");
             break;
         case JUL:
-            printf(JULY);
+            printf(JULY"\n");
             break;
         case AGO:
-            printf(AUGUST);
+            printf(AUGUST"\n");
             break;
         case SEP:
-            printf(SEPTEMBER);
+            printf(SEPTEMBER"\n");
             break;
         case OCT:
-            printf(OCTOBER);
+            printf(OCTOBER"\n");
             break;
         case NOV:
-            printf(NOVEMBER);
+            printf(NOVEMBER"\n");
             break;
         case DEC:
-            printf(DECEMBER);
+            printf(DECEMBER"\n");
             break;
     }    
     return 0;