万年历插件软件测试,万年历的程序代码

这篇博客分享了一个用Pascal编写的2000年年历程序,旨在帮助99级同学重温编程技巧。作者回顾了编程历程,并欢迎批评指正,提醒读者仅供学习参考,不得抄袭。程序展示了逐月的日历布局和输入年份后的显示。
摘要由CSDN通过智能技术生成

万年历,好遥远的历史了.

回想当年,傻傻编程.

※ 引述《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.

--

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值