Providers
Debian Linux
SDF
MinGW-W64
Verizon
Research
Faqs and RFCs
FileSearching
Google
Google Groups
W3Schools Online Web Tutorials
Wikipedia
Multimedia
CTIS
For the Pigs Among Us
Family Photos
My House
My Photos (1999-2002?)
My Photos (2005)
Retro Computers
Minions of Mirth
Main
Criticals
Criticals (Single Player)
Ghaqua
Maps and Points of Interest
Miscellaneous
Monster Templates
Miscellaneous
Area Codes
Bard’s Tale
Dungeons & Dragons Online
My Blog
Quote of the Day
RogueBasin
Slashdot
The Adventuer’s Guild
Weather
GitHub:eprive/Z80-MBC3
Programming
Main
Across
Biorhythm
BMP Chips
Complex Roots
Magic Square
Magic Square(js)
Matrix(js)
More DOS Programs
Roll
Strip Dups (bash)
Wacky Wood-Worker
How To
Enlightenment 0.16.7.2 Startup Patch
How to Create an OS X Iconset
My RedHat Howto
SSH to VMS (Deathrow OpenVMS Cluster)
Tools
Allowable Mortgage Interest
Dates and Mileage
Day of the Year
Fun With Time
Downloads
Educational
Utilities
easter.pas
program Easter (input, output) ; Uses sysutils; procedure showHelp; begin writeln('Easter'); writeln; writeln('Usage:'); writeln(#9'easter [-c][-h] [CCYY]'); writeln; writeln('Will output the date of Easter for a given year.'); writeln; writeln('-c'#9'Formats the output for use in calendar.'); writeln('-h'#9'Outputs this help message.'); writeln; writeln('CCYY should be the four digit year.'); writeln; writeln('Michael J Chappell 15 April 2024'); writeln('mcsuper5@freeshell.org'); end; procedure calendarOutput(date , year : integer; april : boolean); begin if april then write ('4/') else write ('3/'); writeln (date,#9'Easter (',year,')'); end; procedure humanOutput(date , year : integer; april : boolean); begin write ('Easter is on '); if april then write ('April') else write ('March'); writeln (' ',date,', ',year); end; var a, b, c, d, e : integer; i : integer; code : integer; date : integer; year : integer; april : boolean; calendar : boolean; help : boolean; numset : boolean; Begin numset := False; calendar := False; help := False; for i := 1 to ParamCount do begin if ansiCompareStr(ParamStr (i),'-h')=0 then help := True; if ansiCompareStr(ParamStr (i),'-c')=0 then calendar := True; (* Val sets second argument to value and third to position of the first invalid character *) Val(ParamStr (i), year, code); if code = 0 then numset := True; end; if NOT help then begin (* Get Year *) if (ParamCount = 0) or NOT numset then Begin Write('Enter year> '); Readln(year); End; (* Find the date in March. I don't recall where I found this algorithm. *) a := year mod 19; b := year mod 4; c := year mod 7; d := (19*a+24) mod 30; e := (2*b+4*c+6*d+5) mod 7; date := 22+d+e; (* Fix the date if it falls in April and set flag *) if (date > 31) then begin april := true; date := date mod 31; end else begin april := false; end end; (* Output *) if help then begin showHelp end else if calendar then begin calendarOutput(date, year, april); end else begin humanOutput(date, year, april); end; End.
This source has been viewed 16 times.
Friday, 6 December 2024
Michael J. Chappell
Contact me at:
mcsuper5@freeshell.org