hi. again.. . need some help here
how do u actually convert day integer to date string?
do i have to code it 1 by 1... like
if ( day == 1)
printf("first");
eg:
Enter Day Integer : 3
Third // <-- result show
thanks
hi. again.. . need some help here
how do u actually convert day integer to date string?
do i have to code it 1 by 1... like
if ( day == 1)
printf("first");
eg:
Enter Day Integer : 3
Third // <-- result show
thanks
If you want the day of the week, you could to this:
However, it sounds like you want the day of the month.Code:char *weekday[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; printf("Today is %s\n",weekday[day]);
aawww..
i was supposed to program the day and month
eg.
enter day : 1
enter month : 5
result: First of May
i have to code from 1 to 31 for day and 12 for month?
no other way round?
I would just make two arrays, one for the list of months, and one for the list of days.
Unfortunately, you need an array of 31 day strings. There's not really a pattern where you could break it into two parts, until you get to twenties.Code:char *months[12] = {"Jan","Feb",...}; char *days[31] = {"first","second","third","fourth","fifth", "sixth","seventh","eighth","nighth",...}; . . printf("Today is %s of %s\n",days[day],months[mon]);