Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
53
Task/Calendar/Seed7/calendar.seed7
Normal file
53
Task/Calendar/Seed7/calendar.seed7
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "time.s7i";
|
||||
|
||||
const func string: center (in string: stri, in integer: length) is
|
||||
return ("" lpad (length - length(stri)) div 2 <& stri) rpad length;
|
||||
|
||||
const proc: printCalendar (in integer: year, in integer: cols) is func
|
||||
local
|
||||
var time: date is time.value;
|
||||
var integer: dayOfWeek is 0;
|
||||
const array string: monthNames is [] ("January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December");
|
||||
var array array string: monthTable is 12 times 9 times "";
|
||||
var string: str is "";
|
||||
var integer: month is 0;
|
||||
var integer: position is 0;
|
||||
var integer: row is 0;
|
||||
var integer: column is 0;
|
||||
var integer: line is 0;
|
||||
begin
|
||||
for month range 1 to 12 do
|
||||
monthTable[month][1] := " " & center(monthNames[month], 20);
|
||||
monthTable[month][2] := " Mo Tu We Th Fr Sa Su";
|
||||
date := date(year, month, 1);
|
||||
dayOfWeek := dayOfWeek(date);
|
||||
for position range 1 to 43 do
|
||||
if position >= dayOfWeek and position - dayOfWeek < daysInMonth(date.year, date.month) then
|
||||
str := succ(position - dayOfWeek) lpad 3;
|
||||
else
|
||||
str := "" lpad 3;
|
||||
end if;
|
||||
monthTable[month][3 + pred(position) div 7] &:= str;
|
||||
end for;
|
||||
end for;
|
||||
writeln(center("[Snoopy Picture]", cols * 24 + 4));
|
||||
writeln(center(str(year),cols * 24 + 4));
|
||||
writeln;
|
||||
for row range 1 to succ(11 div cols) do
|
||||
for line range 1 to 9 do
|
||||
for column range 1 to cols do
|
||||
if pred(row) * cols + column <= 12 then
|
||||
write(" " & monthTable[pred(row) * cols + column][line]);
|
||||
end if;
|
||||
end for;
|
||||
writeln;
|
||||
end for;
|
||||
end for;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
printCalendar(1969, 3);
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue