Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language output 20 15 calendar, which requires a line of three months (that is, quarterly output).
C language output 20 15 calendar, which requires a line of three months (that is, quarterly output).
//Enter any year and enter the calendar of that year.

//Why not run it and see the results? Not every three months? Why don't you change it yourself and just add a line break?

# include & ltstdio.h & gt

# include & ltwindows.h & gt

# include & ltstdlib.h & gt

int? Runnian (int? Year); //Judge whether it is a leap year.

int? longmonth? (int? Year, int? Mouth) //Judge the number of days in each month

int? year _ fristday? (int? Year); //Judge what day is the first day of New Year's Day every year.

//int? month _ first day(int? Year, int? Month); //Determine the day of the week on the first day of each month.

int? Master ()

{

int? Year;

int? j,month= 1,I,c=0,day,weekday,d=0,a;

System ("color? 3E”);

Printf ("Please? Input? Year. \ n ");

Sleep (1000);

Printf ("for example, 2015 \ n");

Scanf("%d ",& year);

printf("\n\n\n? %d year \n\n ",year);

System ("CLS");

Weekday = year _ Friday (year);

D = working days;

//? Printf("%d ",working day); (Check whether the meta function is correct)

for(I = 1; I< 13; i++)

{

Printf("%d month \n ",i);

printf("-\ n ");

printf(" SUNMONTUEWEDTHUFRISAT \ n ");

printf("-\ n ");

//printf("% d ",days);

if(month== 1)

for(j = 0; J< working days; j++)

printf(" ");

other

{

D =(d+ days)% 7;

//? D = d+ working days;

if(d & lt; 7)

for(j = 0; j & ltd; j++)

printf(" ");

other

{

d = d-7;

for(j = 0; j & ltd; j++)

printf(" ");

}

}

a = d+ 1;

Day=longmonth (year, month);

for(c = 1; C< (day+1); c++,a++)

{

printf("? %2d”,c);

If (a%7==0)

printf(" \ n ");

}

printf(" \ n \ n ");

month++;

//Sleep (1000);

}

getchar();

getchar();

Return? 0;

}

int? longmonth? (int? Year, int? Month)

{

int? Month _ day, a;

A = Runnian (year);

If (a== 1)

{

if(month = = 1 | | month = = 3 | | month = = 5 | | month = = 7 | | month = = 8 | | month = = 10 | | month = = 12)

month _ day = 3 1;

If (month = = 2 ||| month = = 4 ||| month = = 6 ||| month = = 9 | | month = =1)

Month _ day = 30;

if(month==2)

Month _ day = 29;

}

other

{

if(month = = 1 | | month = = 3 | | month = = 5 | | month = = 7 | | month = = 8 | | month = = 10 | | month = = 12)

month _ day = 3 1;

If (month = = 2 ||| month = = 4 ||| month = = 6 ||| month = = 9 | | month = =1)

Month _ day = 30;

if(month==2)

Month _ day = 28;

}

Return? Month _ day;

}

int? year _ fristday? (int? Year)

{

int? n,b;

N = year-1900;

n = n/4+n+ 1;

b = n % 7;

Return? b;

}

int? Runnian (int? Year)

{

int? n;

If (year% 100==0)

{

If (year %400==0)

n = 1;

other

n = 0;

}

other

{

If (year %4==0)

n = 1;

other

n = 0;

}

Return? n;

}

//@ Author? zjb