/*
____________________________________
/ This is a very useful tool, you can \
| enter a date such as 2004 4 3, the |
| program will output the date of the |
| week, my first linux program. by |
\ [email protected] /
-------------------------------------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/
*/
#include <stdio.h>
int main()
{ int year,month,day,n;
printf(" ------------------------------------------------------------- \n");
printf("* || // || >>>> *\n");
printf("* || // ||// Weeks *\n");
printf("* || \\ || __ __ __ __ ___ __ *\n");
printf("* || \\ || {__ (__|_ |_ {__ |_|. |_ (__|_ | (__) |^ *\n");
printf("* || \\ || *\n");
printf(" ------------------------------------------------------------- \n");
do
{
printf("please input date like 2010 4 3\n");
printf("you can enter 0 0 0 to quit\n");
scanf("%d%d%d",&year,&month,&day);
if(year==0)
{
printf(" ######## D ** D \n");
printf(" $ ======== ======== D D \n");
printf(" $ || || || || D D \n");
printf(" $ ==== || || || || D D \n");
printf(" $ %% || || || || D D \n");
printf(" $ %% || || || || D D \n");
printf(" ######### ======== ======== D ** \n");
printf(" \n");
printf(" BBBBBB Y Y EEEEEE \n");
printf(" B B Y Y E \n");
printf(" BBBBBB Y EEEEE \n");
printf(" B B Y E \n");
printf(" B B Y E \n");
printf(" BBBBBBB Y EEEEEE \n");break;}
else
{
n=(day + 2*month + 3*(month+1)/5 + year + year/4 - year/100 + year/400) % 7;
switch(n)
{
case 0:printf("today is Monday\n");break;
case 1:printf("today is Tuesday\n");break;
case 2:printf("today is Wednesday\n");break;
case 3:printf("today is Thursday\n");break;
case 4:printf("today is Friday\n");break;
case 5:printf("today is Saturday\n");break;
case 6:printf("today is Sunday\n");break;
default:printf("error!");break;
}
}
}
while (year!=0);
return 0;
}
|