Program code for perpetual calendar

Source: Internet
Author: User

: A year did not touch Pascal, write up a little hard, I hope to 99 students a little help.
: The program has been compiled, with the 2000 calendar;
: Please criticize the deficiencies.
: Only reference, not plagiarism.
: 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 Todo write ();
: Write (No.,k:2);
: For I:=1 to 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 the ' the '.}
: 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 could help for the year yo calender
: u input.);
: again:year:=0;
: ran:=0;
: for i:=1 todo first_month[i]:=0;
: Writeln (Please input the year number:);
: Readln (year);
: if (year mod-=0) or (year mod $#@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) + (all_years
: Div 400);
: first_month[1]:= (all_days+1) mod 7;
: For i:=2 to does 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 Almanac:
: This program could help you for calender of the year for your 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| 50: 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| 50: 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| |
: || | | | | | | || || 50: 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.
--

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.