Problem output should be:
1st screen:
Enter Month : 4
Enter days : 30
First day of the Month : 4
2nd screen:
April
SMTWTFS
.......1234
567891011
the calendar should start on wednesday due inputted firstday is 4.
heres my code: i cant come up with the proper calendar output....
any replies is a big help.. thank you..
Code:
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
printf("Input Month Number : ");
scanf("%d",&month);
printf("Number of days : ");
scanf("%d",&days);
printf("First day of the month : ");
scanf("%d",&firstday);
clrscr();
switch(month)
{
case 1: printf("\tJanuary\n\n");break;
case 2: printf("\tFebruary\n\n");break;
case 3: printf("\tMarch\n\n");break;
case 4: printf("\tApril\n\n");break;
case 5: printf("\tMay\n\n");break;
case 6: printf("\tJune\n\n");break;
case 7: printf("\tJuly\n\n");break;
case 8: printf("\tAugust\n\n");break;
case 9: printf("\tSeptember\n\n");break;
case 10: printf("\tOctober\n\n");break;
case 11: printf("\tNovemer\n\n");break;
case 12: printf("\tDecember\n\n");break;
}
gotoxy(11,3);
textcolor(12);
cprintf("S");
gotoxy(21,3);
printf("M");
gotoxy(31,3);
printf("T");
gotoxy(41,3);
printf("W");
gotoxy(51,3);
printf("T ");
gotoxy(61,3);
printf("F");
gotoxy(71,3);
printf("S");
printf("\n");
switch(firstday)
{
case 1:gotoxy(11,5);y=11;break;
case 2:gotoxy(21,5);y=11;break;
case 3:gotoxy(31,5);y=11;break;
case 4:gotoxy(41,5);y=11;break;
case 5:gotoxy(51,5);y=11;break;
case 6:gotoxy(61,5);y=11;break;
case 7:gotoxy(71,5);y=11;break;
}
w=8-firstday;
for(x=1;x<=days;x++)
{
if(x<=w){
printf("%d",x);
y=y+10;
gotoxy(y,z);
}
}
getch();
return 0;
}