I have to code a Calendar for C++ and I have been stuck on this problem for a long time.
Ok, the first thing I do is prompt for a year and month from the user.
Next, I use the year to find the first day of the input year ( 0 - Sunday to 6 - Saturday) and the month to find the number of days in the input month.

Next I have to use the value I found for the first day of the input year to calculate the first day of the input month ( 0 - Sunday to 6 - Saturday).

From there I am supposed to generate and print the month calendar to the screen

I just can't figure out how to code my:
getFirstDayOfMonth (int m, int fD, int &sD) function or my
generateCalendar (int y, int m, int sD, int d) function

Can someone help me?


Code:
//********************************************************************
//
// (Computer Science I)
//
// Date Created: 03-17-07
//
// Date Modified: 03-17-07
//
// Program Name: PROJECT #1 - Virtual Calendar
//
// Purpose: To generate a virtual month calendar for any month of any
//		   year and print it to the user's screen.
//
//********************************************************************

#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>

#define cls system ("cls")
#define pause system ("pause")

using namespace std;

//
// function prototypes
//
void getYearAndMonth (int &y, int &m);

bool leapYearCheck (int y);

void leapNumMonthDays (int fD, int &d);

void numMonthDays (int fD, int &d);

void getFirstDayOfYear (int y, int &fD);


//*** Not Finished ***
void getFirstDayOfMonth (int m, int fD, int &sD);
//*** Not Finished ***


//*** Not Finished ***
void generateCalendar (int y, int m, int sD, int d);
//*** Not Finished ***



int main () // start of main function
{
//
// local main variables
//
		int year,
		    month,
			firstDay,// first day of year
			startDay, // first day of input month
			days;  

		cout << "Welcome to the Virtual Calendar!" << "\n\n";

//
// function calls
//
		getYearAndMonth (year, month);

		if (leapYearCheck (year))
		{
			leapNumMonthDays (month, days); // get # of day in month for leap year
		}

		numMonthDays (month, days); // get # of days in month for normal year

		getFirstDayOfYear (year, firstDay);

//*** Not Finished ***
		getFirstDayOfMonth (month, firstDay, startDay); // first day of input month

		generateCalendar (year, month, startDay, days); // print calendar for input month
//*** Not Finished ***

		


		return 0;
}// end of main function



//********************************************************************
//
// Function Name: getYearAndMonth
//
// Purpose: To get the year of the month calendar to be generated 
//         from keyboard input by the user.
//
// Input Parameters: none 
//
// Output Parameters: year, month
//
// Return Value: none
//
//********************************************************************

void getYearAndMonth (int &y, int &m)
{
	cout << "Please enter the year for your month calendar: ";

		cin >> y;

	cout << "Now please enter the month of the year required: ";

		cin >> m;

	return;
}// getYear



//********************************************************************
//
// Function Name: leapYearCheck
//
// Purpose: To test whether or not the year input is a leap year or 
//         not
//
// Input Parameters: month
//
// Output Parameters: none
//
// Return Value: True or False
//
//********************************************************************

bool leapYearCheck (int y)
{

	if ( ( !(y % 4) && (y % 100) ) || !(y % 400) )
	{
		return (true);
	}
	else
	{
		return (false);
	}
}// leapYearCheck



//********************************************************************
//
// Function Name: leapNumMonthDays
//
// Purpose: To get the number of the beginning day and ending day of
//         the input month based on the 366 days of leap year
//
// Input Parameters: month
//
// Output Parameters: days
//
// Return Value: none
//
//********************************************************************

void leapNumMonthDays ( int m, int &d)
{
if (m == 1 || m == 3 || m == 5 || m == 7)
{
	d = 31;
}
else if (m == 8 || m == 10 || m == 12)
{
	d = 31;
}
else if (m == 4 || m == 6 || m == 9 || m == 11)
{
	d = 30;
}
else
{
	d = 29;
}// end of if statement

	return;
}// leapMonths


//********************************************************************
//
// Function Name: numMonthDays
//
// Purpose: To get the number of the beginning day and ending day of
//         the input month based on the 365 days of the year 
//
// Input Parameters: month
//
// Output Parameters: days
//
// Return Value: none
//
//********************************************************************

void numMonthsDays  ( int m, int &d)
{
	if (m == 1 || m == 3 || m == 5 || m == 7)
	{
		d = 31;
	}
	else if (m == 8 || m == 10 || m == 12)
	{
		d = 31;
	}
	else if (m == 4 || m == 6 || m == 9 || m == 11)
	{
		d = 30;
	}
	else
	{
		d = 28;
	}

	return;
}// Months


//********************************************************************
//
// Function Name: getFirstDayOfYear
//
// Purpose: To compute the numerical value of the first day of the
//         input year
//
// Input Parameters: year 
//
// Output Parameters: firstDay
//
// Return Value: none
//
//********************************************************************

void getFirstDayOfYear (int y, int &fD)
{	
//
// Equation to calculate first day of year has been broken up and
// assigned to variables to make the math computation easier to read
//
	int eq_1 = (y - 1) * 365,
		eq_2 = (int)floor( (y - 1) / 4 ),
		eq_3 = (int)floor( (y - 1) / 100 ),
		eq_4 = (int)floor( (y - 1) / 400 );

	fD = ( ( eq_1 + eq_2 - eq_3 + eq_4 ) + 1 ) % 7;

	return;

}// getFirstDayOfYear



//********************************************************************
//
// Function Name: getFirstDayOfMonth
//
// Purpose: To compute the numerical value of the first day of the
//         input month for the input year
//
// Input Parameters: month, firstDay
//
// Output Parameters: startDay
//
// Return Value: none
//
//********************************************************************

void getFirstDayOfMonth (int m, int fD, int &sD)
{

	if (m == 1)
	{
		sD = fD;
	}

	






	return;
} // getFirstDayOfMonth



//********************************************************************
//
// Function Name: generateCalendar
//
// Purpose: To generate the virtual month calendar and print it to 
//         the screen
//
// Input Parameters:  startDay, endDay
//
// Output Parameters: none
//
// Return Value: none
//
//********************************************************************

void generateCalendar (int y, int m, int sD, int d)
{
	cout << char(201);
 
	return;
}// generateCalendar