Dejenme colgar la version libreria :))
Código C:
Ver original//dias.h
#ifndef _DIASH
#define _DIASH
typedef unsigned char size_dia;
enum DDIAS {DDL = 1, DDM, DDX, DDJ, DDV, DDS, DDD, DCTD};
#ifdef DD_CA
static char *SDIAS[DCTD] = {"Dil", "Dil", "Dim", "Dix", "Dij", "Div", "Dis", "Diu"};
static char SDOOR[] = "Fora de rang";
#else
static char *SDIAS[DCTD] = {"Lun", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab", "Dom"};
static char SDOOR[] = "Fuera de rango";
#endif
char *dd_dia(size_dia dd) {
return (dd < DCTD)? SDIAS[dd] : SDOOR;
}
#endif
Y ahora lo que nos interesa:
Código C:
Ver original#include <stdio.h>
#include "dias.h"
int main() {
size_dia numero = 0;
printf("Ingrese un numero entre 1 al 7: "); printf("%s\n", dd_dia
(numero
));
return 0;
}
Saludos
vosk