commit 30e257163a1d7bc583811d57b148c48ac5da817a
parent 8513aaabbf05b821921945ec78a0a7276194fac2
Author: Martin J. Klöckner <martin.cachari@gmail.com>
Date: Sat, 14 Nov 2020 11:31:05 -0300
Finished ej8.c
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/guia02/ej8.c b/src/guia02/ej8.c
@@ -9,8 +9,9 @@
#define SND_YR 95
#define TRD_YR 143
+
typedef enum {
- FIRST, SECOND, THIRD
+ FIRST, SECOND, THIRD, FOURTH
} year_t;
@@ -39,12 +40,14 @@ int main(void) {
}
d = atoi(buffer);
- if (d <= FST_YR)
+ if (d <= FST_YR)
e = FIRST;
- else if (d > FST_YR && d <= TRD_YR)
+ else if ((d > FST_YR) && (d <= SND_YR))
e = SECOND;
- else if (d > TRD_YR)
+ else if ((d > SND_YR) && d <= (TRD_YR))
e = THIRD;
+ else if (d > TRD_YR)
+ e = FOURTH;
switch (e)
@@ -56,7 +59,10 @@ int main(void) {
printf("Segundo año\n");
break;
case THIRD:
- printf("Tercer año o superior\n");
+ printf("Tercer año\n");
+ break;
+ case FOURTH:
+ printf("Curto año o superior\n");
break;
}
return 0;