Please heLP me in my finAl pRojEct pLLZz,,guyZz!!!All about C program in quincy that reads the year and day of the week of the first day of the year.Then the progrAm prints the calendAr for that year.Allow the user to pause for each month of the year.Note also for the leap years.

Recommended Answers

All 6 Replies

1. Try the program.
2. Post the code where you have the problem.
3. People here will be happy to help, when you have at least tried it.

#include<stdio.h>

#define TRUE    1
#define FALSE   0

int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
char *months[]=
{
	" ",
	"\n\n\nJanuary",
	"\n\n\nFebruary",
	"\n\n\nMarch",
	"\n\n\nApril",
	"\n\n\nMay",
	"\n\n\nJune",
	"\n\n\nJuly",
	"\n\n\nAugust",
	"\n\n\nSeptember",
	"\n\n\nOctober",
	"\n\n\nNovember",
	"\n\n\nDecember"
};

int inputyear(void)
{
	int year;

	printf("Please enter a year (example: 1999) : ");
	scanf("%d", &year);
	return year;
}

int determinedaycode(int year)
{
	int daycode;
	int d1, d2, d3;

	d1 = (year - 1.)/ 4.0;
	d2 = (year - 1.)/ 100.;
	d3 = (year - 1.)/ 400.;
	daycode = (year + d1 - d2 + d3) %7;
	return daycode;
}

int determineleapyear(int year)
{
	if(year% 4 == FALSE && year%100 != FALSE || year%400 == FALSE)
	{
		days_in_month[2] = 29;
		return TRUE;
	}
	else
	{
		days_in_month[2] = 28;
		return FALSE;
	}
}

void calendar(int year, int daycode)
{
	int month, day;
	for ( month = 1; month <= 12; month++ );
	{
		printf("%s", months[month]);
		printf("\n\nSun  Mon  Tue  Wed  Thu  Fri  Sat" );

		// Correct the position for the first date
		for ( day = 1; day <= 1 + daycode * 5; day++ )
		{
			printf("Enter the days ");
		}

		// Print all the dates for one month
		for ( day = 1; day <= days_in_month[month]; day++ )
		{
			printf("%2d", day );

			// Is day before Sat? Else start next line Sun.
			if ( ( day + daycode ) % 7 > 0 )
				printf("   " );
			else
				printf("\n " );
		}
			// Set position for next month
			daycode = ( daycode + days_in_month[month] ) % 7;
	}
}

int main(void)
{
	int year, daycode, leapyear;

	year = inputyear();
	daycode = determinedaycode(year);
	determineleapyear(year);
	calendar(year, daycode);
	printf("\n");
}

actually that code is not mine ive researched it from the internet!!..I found it very hard...do you have a codes guyZ???pLZ..that is my finAl project sO i can pass my exam

Please stop using cutsey text. Beginning letters of sentences are in upper case, the rest in lower case, as per English Writing Style.

Yes we have the code. Can you have it? No. We do not give code for the purposes of cheating. It's your class, not ours.

Ok..its your decision sir,anyway thank you for the time and sorry for the disturbed..
maybe i will try to ask help in other site...thanks a lot..hope i can pass it!!!

Funny people come here, he hasn't done the work and he is still showing arrogance..

Why don't they understand that when they will work for someone in future, people come to them to ask about these things. So they should try to learn rather than finding back doors for temporary success in a test or a project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.