-
Hehe, the command line type cal -y 2008 will do.
-
#include""
int judge(int year,int month) defines a function that divides months into four categories (28,29,30,31).
else return(4);*30-day month, the return value is 4* }main().
char*month=;
clrscr();
printf("please inter the year:");
scanf("%d",&year);
printf("");
printf("the calendar of the year%d.",year);
printf("");
a=(year+(year-1)/4-(year-1)/100+(year-1)/400)%7;
for(i=0;i<4;i++) * output calendar of previous months * printf("");
for(k=0;kprintf(" ");*six spaces* for(m=1; m<32;m++)
a=(a+m)%7;*Calculate what day of the week the first day of the next month is* printf("");
printf("********************==");
printf("");
-
#include
using namespace std;
int leapyear(int year);
int main()
for(i=1;i<=b-1;i++)
else if(i==4||i==6||i==9||i==11)else if(i==2)
result+=c%7;
result%=7;
if(result==0)
result = 7;
cout <<"It's the week"
To determine whether it is a leap year, if it is a leap year, return 1 (366 days), otherwise, return 0 (365 days).
int leapyear(int year) can be done with a few minor changes.
-
: Defines the entry point for the console application.
#include ""
#include
#include
#include
using namespace std;
void week(int y, int m, int d) date for the week.
c = y / 100 + 1;
if( m <= 2)
w = ( y + y / 4 + c / 4 - 2 * c + 26 * m + 1 ) / 10 + d - 1 ) 7;
cout
cout <<"sun";
else if (w == 1)
cout<<"mon";
else if (w == 2)
cout<<"tue";
else if (w == 3)
cout<<"wed";
else if (w == 4)
cout<<"thu";
else if ( w == 5)
cout<<"fri";
else/ cout <<"sta";
Initialize the perpetual calendar based on the system time.
void printmonth(int y, int m, int d) prints out the given time for the monthly calendar,};
int leap,i;
leap = ( y % 4 == 0 &&y % 100 != 0 ||y % 400 == 0);
for( i = 1 ; i < d ; i++
cout <<"★" ;
for(i = d; i <= ym[leap][m]; i++
int judge(int y, int m, int d) to determine whether a given time exists,};
int leap, i;
if( y <= 0 ||m < 1 ||m > 12 )
return 0;
leap = ( y % 4 == 0 &&y % 100 != 0 ||y % 400 == 0 );
if( d < 1 ||d > ym[leap][m] )
return 0;
elsereturn 1;
int search(int y, int m, int d) finds the corresponding experience for a given time to print.
int main()
return 0;}
-
#include
define yes 1 defines the sign constant"Yes"
define no 0 defines the sign constant"Nope"
Function isleap(): Determines whether a leap year is int isleap(int year).
Function week of newyears day(): Find the day of the week when New Year's Day is.
int week of newyears day(int year) main function: Prints the calendar.
int main()
cout <