Using this file

Calendar.c
Code:
#include <stdio.h>
#include <header.h>
main()
{
	char dummy;
	int i, end_of_line, days_in_month=30; 
	printf("Please enter a year: ");
	scanf("%i", &a.year);
	printf("Please enter a month: (1=Jan, 12=Dec): ");
	scanf("%i",&a.month);
	printf("Please enter the starting day of the month (1=Sun, 7=Sat): ", &a.starting_day);
	scanf("%i", &a.starting_day);
	/* call function to determine the number of days in the month*/
	
	printf("S\tM\tT\tW\tT\tF\tS\n");
	switch (a.starting_day)
		{
			case 1: end_of_line=7;
			break;
			case 2: end_of_line=6;
				printf("\t");
			break;
			case 3: end_of_line=5;
				printf("\t\t");
			break;
			case 4: end_of_line=4;
				printf("\t\t\t");
			break;
			case 5: end_of_line=3;
				printf("\t\t\t\t");
			break;
			case 6: end_of_line=2;
				printf("\t\t\t\t\t");
			break;
			case 7: end_of_line=1;
				printf("\t\t\t\t\t\t");
		}
	
	for(i=1; i<=days_in_month; i++)
	{	
	printf("%i\t",i);	
		
	if(end_of_line==1)
	
	{	
	printf("\n");
	end_of_line=7;
	}	
	else
		end_of_line = end_of_line-1;
	}
	
	
	scanf("%c", &dummy);
}
and calling programs from this

header.h
Code:
struct user_input
{
	int year;
	int month;
	int starting_day;
};

struct user_input a;
giving you the code for the basic calendar program that asks the user to input a month (1=January…12=December), a starting day for the day of the week the calendar starts (1=Sunday…7=Saturday) and the year.

The code is in a header file named header.h which is up here, and the main program is in a file named calendar.c which is the first one.
You need to add to the calendar program in the following way:

Print out the name of the month and the year at the top of the calendar. For example if the user types in 5 for May and 2008 as the year and starting day of 5 they should see
Code:
		May 2008
S	M	T	W	T	F	S 
				 1	 2	 3
 4	 5	 6	 7	 8	 9	10
11	12	13	14	15	16	17
18	19	20	21	22	23	24
25	26	27	28	29	30	31
Given the month you will write a function to determine the number of days in the month. September, April, June and November have 30 days, February 28 or 29 depending on leap year and all the rest of the months 31. The calendar.c file currently defaults to printing out 30 days.

Leap years are years that are evenly divisible by 4 or 100. (Hint: mod operation)

The function should be in a separate file named months.c
The main program should continue to run until the user wants to stop printing calendars.

Add error checking, for example the month value must be a number between 1 and 12.

Please help me to resolve this, and explain a little bit, because i really cant figure out what i am doing wrong even from the beggining. Thanks again for your time, and your help.