#include #include #include typedef enum Day { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY }Day; int DayTill(Day Current, Day Other) { if(Current < Other) { return Other-Current; } else { return SUNDAY-Current + Other; } } char *EnumToString(char *Dest, enum Day WeekDay) { switch(WeekDay) { case MONDAY: { strcpy(Dest,"monday"); }break; case TUESDAY: { strcpy(Dest,"tuesday"); }break; case WEDNESDAY: { strcpy(Dest,"wednesday"); }break; case THURSDAY: { strcpy(Dest,"thursday"); }break; case FRIDAY: { strcpy(Dest,"friday"); }break; case SATURDAY: { strcpy(Dest,"saturday"); }break; case SUNDAY: { strcpy(Dest,"sunday"); }break; } return Dest; } int main(int argc, const char *argv[]) { if (TUESDAY > MONDAY) { printf("Tuesday is larger %d.\n", TUESDAY); } char Buffer[32],Buffer2[32]; printf("Today is %s. %d days until next %s", EnumToString(Buffer, atoi(argv[1])), DayTill(atoi(argv[1]), atoi(argv[2])), EnumToString(Buffer2, atoi(argv[2]))); }