Calendar from 1901 to 2008 in C++ (i have started, anyone can do it for me)

please help me to finish my calendar!
it is a C++ program that you will
input the month and year.
then the output will be the calender
of the asked month and year!

____________________________________________________________________

int newYearDay(int year)
{
const newYear1901=2;
int elapseYear=year-1901;
int leapYear=elapseYear/4;
return(newYear1901+elapseYear+leapYear)%7;
}

int monthDays(int month, int year)
{
int days=0;
switch(month)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:days=31;break;
case 4:case 6:case 9:case 11:days=30;break;
case 2:days=(year%4==0)?29:28;
}
return days;
}
int firstDay(int month, int year)
{
int elapseDay=newYearDay(year);
int i=1;
if(month>1)
{
for(;i<month;i++)
{
elapseDay=monthDays(month, year);
}
}
return elapseDay%7;
}

void chart(int monthDays,int startDay)
{
int i=1;
int j=1;
printf("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n");
for(;i<=42;i++)
{
if(i<=startDay)
{
printf("\t");
}
else
{
if(j<=monthDays)
{
if(i%7==0)
{
printf("%3d\n", j);
}
else
{
printf("%3d\t", j);
}
j++;
}
}
}
}

void main()
{

int month=0;
int year=0;
clrscr();
printf("enter month\t(1-12):\t\t");scanf("%d", &month);
printf("enter year\t(1901-2008):\t");scanf("%d", &year);
chart(31,1);
getch();
}
Please do not double post.
okay lets just talk
on the first thread that i made!
Topic archived. No new replies allowed.