万年历的程序代码

2008-04-09 04:39:56来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

万年历,好遥远的历史了.
回想当年,傻傻编程.
※ 引述《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||

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:万年梨吃法之我见

下一篇:ADO的建立连线