c-first-steps

a C playground
Index Commits Files Refs README
commit e7406a15e64c2483b214c22f9a5a784f6cd1f949
parent 313069e1792b40fe04c3c12fed44eb46fd0f84ba
Author: Martin J. Klöckner <martin.cachari@gmail.com>
Date:   Wed, 18 Nov 2020 14:39:48 -0300

Modified name to keep numbers order

Diffstat:
A95.11/guia02/ex10.c | 39+++++++++++++++++++++++++++++++++++++++
A95.11/guia02/ex14.c | 11+++++++++++
A95.11/guia02/ex16.c | 16++++++++++++++++
A95.11/guia02/ex17.c | 12++++++++++++
4 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/95.11/guia02/ex10.c b/95.11/guia02/ex10.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+
+#define TM "3M Corporation"
+#define MAXWELL "Maxwell Corporation"
+#define SONY "Sony Corporation"
+#define VERBATIM "Verbatim Corporation"
+
+typedef enum {
+    TM_CORPORATION,
+    MAXWELL_CORPORATION,
+    SONY_CORPORATION,
+    VERBATIM_CORPORATION
+} manufacturer_t;
+
+
+int main(void) {
+    manufacturer_t c;
+    printf("Introduzca un Id. de fabricante: ");
+    c = (getchar() - '0');
+    switch(c) {
+        case TM_CORPORATION:
+            printf(TM"\n");
+            break;
+        case MAXWELL_CORPORATION:
+            printf(MAXWELL"\n");
+            break;
+        case SONY_CORPORATION:
+            printf(SONY"\n");
+            break;
+        case VERBATIM_CORPORATION:
+            printf(VERBATIM"\n");
+            break;
+        default:
+            printf("El numero ingresado no es valido\n");
+            return 1;
+    }
+    return 0;
+}
diff --git a/95.11/guia02/ex14.c b/95.11/guia02/ex14.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+typedef enum { 
+    1200, 2400, 4800, 9600 
+} baudrate_t;
+
+int main(void) 
+{
+    baudrate_t baudrate = 9600;
+    return 0;
+}    
diff --git a/95.11/guia02/ex16.c b/95.11/guia02/ex16.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+#define TRUE 0
+
+#ifdef TRUE
+    #undef TRUE
+    #define TRUE 1
+#endif
+
+int main(void) 
+{
+    printf("TRUE = %d\n", TRUE);
+    return 0;
+}
+
+
diff --git a/95.11/guia02/ex17.c b/95.11/guia02/ex17.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int main(void)
+{
+    #ifdef DEBUG
+        printf("DEBUGGING\n");
+    #endif
+    
+    printf("Hello world!\n");
+
+    return 0;
+}