Traditional Culture Encyclopedia - The 24 Solar Terms - The perpetual calendar query program is written in C language.
The perpetual calendar query program is written in C language.
I don't have Wintc tested by vc at hand, but I haven't used anything unique to vc either. I think so.
# include & ltstdio.h & gt
# include & ltstdlib.h & gt
# include & ltconio.h & gt
void DayOfWeek()
{
int rtnDay
int y,m,d;
char ch
while ( 1)
{
Printf ("Please enter the year, month and day (xxxx, xx, xx):");
scanf("%d,%d,%d ",& ampy & amp; m & amp; d);
fflush(stdin);
RTN day =(3 * y-(7 *(y+(m+9)/ 12))/4+(23 * m)/9+d+ 17-((y+(m & lt; 3? - 1:0))/ 100+ 1)*3/4) % 7;
Printf("%04d %02d month %02d day is week %d \n ",y, m, d, rtnDay? RTN day:7);
Printf ("Continue query (y/n)");
ch = getchar();
If (ch! = ' y ' & amp& ampch! = 'Y ')
Break;
}
}
Void GetMonth (integer d, integer md, integer n)
{
int N,m,d,y,c,Wd;
int i,maxday,I 1;
if(MD & gt; = 13 | | MD & lt; =0)
Printf ("Wrong!" );
other
{
for(I 1 = 0; ; md++,i 1++)
{
If (md==0)
{
MD = 12;
d-= 1;
}
other
if(md== 13)
{
MD = 1;
d+= 1;
}
m = md
printf(" \ n = = = = = = = = = = = = = % D,% 2d = = = = = = = = = = = = \ n ",D,MD);
if(0 & lt; m & amp& ampm & lt= 12)
{
Switch (m)
{
Case1:maxday = 31; Break;
Case 2: If (d% 4 = = 0& & d%100! =0||D%400==0)
maxday = 29
other
maxday = 28
Break;
Case 3: maxday = 31; Break;
Case 4: maxday = 30 breaks;
Case 5: maxday = 31; Break;
Situation 6: maxday = 30; Break;
Case 7: maxday = 31; Break;
Case 8: maxday = 31; Break;
Situation 9: maxday = 30; Break;
Case10: maxday = 31; Break;
Case11:maxday = 30; Break;
Case12: maxday = 31; Break;
Default: printf ("wrong");
}
if(0 & lt; m & amp& ampm & lt=2)
{
n = D- 1;
m = m+ 10;
}
other
{
n = D;
m = m-2;
}
c = N/ 100;
y = N % 100;
wd =(( 1+( 13 * m- 1)/5+y+y/4+c/4-2 * c)% 7+7)% 7;
Printf ("Sun Mou TUR Wednesday Friday Saturday");
for(I = 0; I & ltwd;; i++)
printf("%4c ",' ');
for(d = 1; d & lt= maxdayd++)
{
printf("%4d ",d);
Wd =(Wd+ 1)% 7;
If (Wd==0)
printf(" \ n ");
}
}
other
Printf ("Wrong!" );
if(i 1==n)
Break;
}
}
}
void MonthOfYear()
{
char ch
int y,m;
while ( 1)
{
Printf ("Please enter the year and month (xxxx, xx):");
scanf("%d,%d ",& ampy & amp; m);
fflush(stdin);
GetMonth(y,m,0);
Printf ("\ nContinue query (y/n)");
ch = getchar();
If (ch! = ' y ' & amp& ampch! = 'Y ')
Break;
}
}
void GetYear()
{
char ch
int y;
while ( 1)
{
Printf ("Please enter year:");
scanf("%d ",& ampy);
fflush(stdin);
GetMonth(y, 1, 1 1);
Printf ("\ nContinue query (y/n)");
ch = getchar();
If (ch! = ' y ' & amp& ampch! = 'Y ')
Break;
}
}
int main()
{
char ch
while( 1)
{
System ("CLS");
Printf(" 1。 Query week \ n ");
Printf("2。 Query month \ n ");
Printf("3。 Display a year \ n ");
Printf("4。 Exit the program \ n ");
ch = getchar();
fflush(stdin);
Switch (channel)
{
Case "1":
day ofweek();
Break;
Case "2":
monthofmyear();
Break;
Case "3":
GetYear();
Break;
Case "4":
printf(" Exit(y/n)");
ch = getchar();
fflush(stdin);
if(ch == 'y' || ch == 'Y ')
Exit (0);
Break;
}
}
}
In addition, the product group purchase on the virtual machine group is super cheap.
- Related articles
- The picture shows the top view of the sun with a certain pole as the center. The outer circle in the figure is the equator, and the time shown is Beijing time 18. Look at the picture and answer the fo
- What's the significance of the agricultural proverb "It rains in February"?
- What season is Xiaoman, Jingzhe and Grain Rain?
- Scary solar terms display board
- Guangxi has many of the best in China and often visits chinese national geography. Do you think it's weird?
- Where is the sun on the earth during the winter solstice?
- What solar term grows sesame seeds?
- Is the speed instability of Audi a6l cold car platform related to voltage?
- In Grain Rain tomorrow, the diet should pay attention to "invigorating the spleen and eliminating dampness", and five kinds of stews should be used to adapt to it, so as to eat healthier.
- How many 10-inch balloons can a tank of helium fill?