Anonymous user
Calendar - for "REAL" programmers: Difference between revisions
→{{header|Elena}}
(→{{header|Icon}} and {{header|Unicon}}: Add FORTRAN) |
|||
Line 497:
#define extensions'math.
#define extensions'routines.
#symbol MonthNames = ("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER").
Line 523 ⟶ 521:
theRow << 0.
theDate := Date new &year:(theYear int) &month:(theMonth int) &day:1.
[ theLine
]
Line 533 ⟶ 531:
(theDate month == theMonth)
? [
theLine
control do:
[
theLine
theDate := theDate add &days:1.
Line 546 ⟶ 544:
#var(type:int) aLength := theLine length.
(aLength < 21)
? [ theLine
theRow += 1.
Line 555 ⟶ 553:
available = theRow < 7.
write &index:anIndex
Line 571 ⟶ 569:
#method printTitleTo : anOutput
[
anOutput
]
Line 593 ⟶ 591:
#method printTo:anOutput
[
anOutput
anOutput writeLine.
anOutput
anOutput writeLine writeLine.
#var
#var Months :=
[ CalendarMonthPrinter new &year:(theYear int) &month:((i * theRowLength + j + 1) int) ]].
[
[
aMonth printTitleTo:anOutput.
Line 613 ⟶ 612:
anOutput writeLine.
[
[
aPrinter printTo:anOutput.
Line 630 ⟶ 629:
#symbol program =
[
#var aCalender := Calendar new:(
aCalender printTo:
].</lang>
{{out}}
<pre>
ENTER THE YEAR:1969
[SNOOPY]
1969
JANUARY FEBRUARY MARCH
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 1 2 1 2
6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9
13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16
20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23
27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30
31
APRIL MAY JUNE
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 6 1 2 3 4 1
7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8
14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15
21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22
28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29
30
JULY AUGUST SEPTEMBER
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7
7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14
14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21
21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28
28 29 30 31 25 26 27 28 29 30 31 29 30
OCTOBER NOVEMBER DECEMBER
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 1 2 1 2 3 4 5 6 7
6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14
13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21
20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Fortran}}==
|