calendar code Please Help Me :(
Question: Develop a functional decomposition and write a C++ program to print a calendar for one year, given the year and the day of the week that January 1 falls on. It may help to think of this task as printing 12 calendars, one for each month, given the day of the week on which a month starts and the number of days in the month. Each successive month stars on the day of the week that follows the last day of the preeding month. Days of the week should be numbered 0 through 6 for Sunday through Saturday. Years that are divisible by 4 are leap years. (Determining leap years actually is more complicated that this, but for this program it will suffice.) Here is a sample run for an interactive program:
What year do you want a calendar for?
2002
What day of the week does January 1 fall on?
(Enter 0 for Sunday, 1 for Monday, et.c)
2
2002
January
S M T W T F S
1 2 3 4 5
6 7 8 9 10 11 12
.
.
.
.
.
December
S M T W T F S
1 2 3 4 5 6 7
My code: But I get stuck ....
Int Print_Month(int month, int weekstart, int no_of_days)
Void point month header(int month);
Int iweekstart; //global variable
Int main()
{
int year;
cin >> year;
cin >> iweekstart;
for (int k = 1; k <= 12; k++)
{
if (k ==1 || k == 3 || k ==5 || k ==7 || k ==8 || k == 10 || k == 12)
print month (k, iweekstart, 31)
if ( k == 4 || k == 6 || k == 9 || k == 11)
print month ( k, iweekstar, 30)
if ( k == 2)
{
if ( year % 4 == 0)
print month ( k, iweekstart, 29)
else print month (k, iweekstart, 28);
}
return 0;
}
{
char space [4] = “…..”;
print month header (month);
for (int i=1; i<=weekstart; i++)
count<<space;
for (int j = 1; j <= no_of_days; j++)
{
cout << setw(3);
cout << j;
if ( j + weekstart = (weekstar – 1) + no_of_days) % 7;
flush (count);
return 0;
}