|
|
|
万年历的程序代码 |
热 ★★★★ |
|
万年历的程序代码 |
|
作者:闵涛 文章来源:闵涛的学习笔记 点击数:1020 更新时间:2009/4/23 14:57:55 |
|
万年历,好遥远的历史了. 回想当年,傻傻编程. ※ 引述《whfang (我...爱你!)》之铭言: :
一年没碰Pascal了,写起来还有点吃力,希望对99级的同学有点帮助. : 程序已编译通过;附2000年年历; :
不足之处请大家批评指出. : 只限参考,不可抄袭. : Program wnl(input,output); : label :
again; : var : a:char; : i:integer; :
ran,year,all_days,all_years:integer; :
days_month,first_month:array[1..12]of integer; : procedure
display; : var : i,j,k,l,m,n,c,d,mm,nn:integer; : begin
: for j:=0 to 5 do : begin : mm:=1; : nn:=1; : k:=j*2+1;
: l:=j*2+2; : m:=first_month[k]; : n:=first_month[l]; : if m=0
then m:=7; : if n=0 then n:=7; : for i:=1 to 21 do write( ); :
write(No.,k:2); : for i:=1 to 32 do write( ); : writeln(No.,l:2);
: for i:=1 to 8 do write( ); : writeln(||mon|tur|wed|thr|fri|sat|sun||
||mon|tur|wed|thr| : fri|sat|sun||); : write( ||); : for c:=1 to 7
do if c$#@60;m then write( |) else : begin : write(mm:3,|); :
mm:=mm+1; : end; : write(| ||); : for c:=1 to 7 do if c$#@60;n then
write( |) else : begin : write(nn:3,|); : nn:=nn+1; : end; :
writeln(|);{the first line.} : for d:=1 to 5 do : begin : write(
||); : for c:=1 to 7 do if mm>days_month[k] then write( |) else :
begin : write(mm:3,|); : mm:=mm+1; : end; : write(| ||); :
for c:=1 to 7 do if nn>days_month[l] then write( |) else : begin :
write(nn:3,|); : nn:=nn+1; : end; : writeln(|); : end; :
readln; : end; : end; : begin{main} : days_month[1]:=31; :
days_month[2]:=28; : days_month[3]:=31; : days_month[4]:=30; :
days_month[5]:=31; : days_month[6]:=30; : days_month[7]:=31; :
days_month[8 31; : days_month[9]:=30; : days_month[10]:=31; :
days_month[11]:=30; : days_month[12]:=31; : writeln(This program may
help you to make a calender of the year yo : u input.); : again:
year:=0; : ran:=0; : for i:=1 to 12 do first_month[i]:=0; :
writeln(Please input the year number:); : readln(year); : if (year mod
400 =0) or ((year mod 100 $#@60;>0) and (year mod 4=0)) then : ran:=1;
: days_month[2]:=days_month[2]+ran; : all_years:=year-1; :
all_days:=all_years+(all_years div 4)-(all_years div 100)+(all_years :
div 400); : first_month[1]:=(all_days+1) mod 7; : for i:=2 to 12 do
first_month[i]:=(first_month[i-1]+days_month[i-1]) : mod 7; : display;
: writeln(Press enter to continute,Ctrl+C to quit.); : readln; :
goto again; : end.{main} : 2000年年历: : This program may help you
to make a calender of the year you input. : Please input the year
number:2000 : No. 1 No. 2 : ||mon|tur|wed|thr|fri|sat|sun||
||mon|tur|wed|thr|fri|sat|sun|| : || | | | | | 1| 2|| || | 1| 2| 3| 4| 5|
6|| : || 3| 4| 5| 6| 7| 8| 9|| || 7| 8| 9| 10| 11| 12| 13|| : || 10| 11|
12| 13| 14| 15| 16|| || 14| 15| 16| 17| 18| 19| 20|| : || 17| 18| 19|
20| 21| 22| 23|| || 21| 22| 23| 24| 25| 26| 27|| : || 24| 25| 26| 27| 28|
29| 30|| || 28| 29| | | | | || : || 31| | | | | | || || | | | | | | || :
No. 3 No. 4 : ||mon|tur|wed|thr|fri|sat|sun||
||mon|tur|wed|thr|fri|sat|sun|| : || | | 1| 2| 3| 4| 5|| || | | | | | 1| 2||
: || 6| 7| 8| 9| 10| 11| 12|| || 3| 4| 5| 6| 7| 8| 9|| : || 13| 14| 15|
16| 17| 18| 19|| || 10| 11| 12| 13| 14| 15| 16|| : || 20| 21| 22| 23| 24|
25| 26|| || 17| 18| 19| 20| 21| 22| 23|| : || 27| 28| 29| 30| 31| | || ||
24| 25| 26| 27| 28| 29| 30|| : || | | | | | | || || | | | | | | || : No.
5 No. 6 : ||mon|tur|wed|thr|fri|sat|sun|| ||mon|tur|wed|thr|fri|sat|sun||
: || 1| 2| 3| 4| 5| 6| 7|| || | | | 1| 2| 3| 4|| : || 8| 9| 10| 11| 12|
13| 14|| || 5| 6| 7| 8| 9| 10| 11|| : || 15| 16| 17| 18| 19| 20| 21|| || 12|
13| 14| 15| 16| 17| 18|| : || 22| 23| 24| 25| 26| 27| 28|| || 19| 20| 21|
22| 23| 24| 25|| : || 29| 30| 31| | | | || || 26| 27| 28| 29| 30| | || :
|| | | | | | | || || | | | | | | || : No. 7 No. 8 :
||mon|tur|wed|thr|fri|sat|sun|| ||mon|tur|wed|thr|fri|sat|sun|| : || | | | |
| 1| 2|| || | 1| 2| 3| 4| 5| 6|| : || 3| 4| 5| 6| 7| 8| 9|| || 7| 8| 9| 10|
11| 12| 13|| : || 10| 11| 12| 13| 14| 15| 16|| || 14| 15| 16| 17| 18| 19|
20|| : || 17| 18| 19| 20| 21| 22| 23|| || 21| 22| 23| 24| 25| 26| 27|| :
|| 24| 25| 26| 27| 28| 29| 30|| || 28| 29| 30| 31| | | || : || 31| | | | | |
|| || | | | | | | || : No. 9 No.10 : ||mon|tur|wed|thr|fri|sat|sun||
||mon|tur|wed|thr|fri|sat|sun|| : || | | | | 1| 2| 3|| || | | | | | | 1||
: || 4| 5| 6| 7| 8| 9| 10|| || 2| 3| 4| 5| 6| 7| 8|| : || 11| 12| 13|
14| 15| 16| 17|| || 9| 10| 11| 12| 13| 14| 15|| : || 18| 19| 20| 21| 22| 23|
24|| || 16| 17| 18| 19| 20| 21| 22|| : || 25| 26| 27| 28| 29| 30| || || 23|
24| 25| 26| 27| 28| 29|| : || | | | | | | || || 30| 31| | | | | || :
No.11 No.12 : ||mon|tur|wed|thr|fri|sat|sun||
||mon|tur|wed|thr|fri|sat|sun|| : || | | 1| 2| 3| 4| 5|| || | | | | 1| 2|
3|| : || 6| 7| 8| 9| 10| 11| 12|| || 4| 5| 6| 7| 8| 9| 10||
: || 13|
14| 15| 16| 17| 18| 19|| || 11| 12| 13| 14| 15| 16| 17|| : || 20| 21| 22|
23| 24| 25| 26|| || 18| 19| 20| 21| 22| 23| 24|| : || 27| 28| 29| 30| | | ||
|| 25| 26| 27| 28| 29| 30| 31|| : || | | | | | | || || | | | | | | || :
Press enter to continute,Ctrl+C to quit.
--
没有相关教程
|
|
教程录入:mintao 责任编辑:mintao |
|
|
上一篇教程: 万年梨吃法之我见 下一篇教程: ADO的建立连线 |
|
|
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网] |
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
|
|
|
|
|
|
|
同类栏目 |
|
|
赞助链接 |
|
|
500 - 内部服务器错误。
|
|
|
|
|
|