Calendar: Difference between revisions

Content added Content deleted
No edit summary
Line 3,908:
{{out}}
See D output.
 
=={{header|Liberty BASIC}}==
<lang lb>
rem Adapted from LB examples included with software
[start]
prompt "Enter year(yyyy)?";year
if year<1900 then notice "1900 or later":goto [start]
ax=1:gx=8:ay=3:gy=10
locate 52,1:print year
for mr = 0 to 3
for mc = 0 to 2
mt=mt+1
aDate$ = str$(mt)+"/01/"+str$(year)
px = ax+mc*gx
py = ay+mr*gy
gosub [printout]
next mc
next mr
gosub [snoopy]
end
 
[printout]
locate 4*px-3+int((30-len(monthname$(aDate$)))/2),py
print monthname$(aDate$)
FirstDay=date$(word$(aDate$,1,"/")+"/1/"+word$(aDate$,3,"/"))
LastDay$=date$(date$(word$(date$(FirstDay+32),1,"/")+"/1/"+word$(date$(FirstDay+32),3,"/"))-1)
dow=val(word$("3 4 5 x 6 7 x 1 2",int((FirstDay/7-int(FirstDay/7))*10)+1))
locate px*4-3, py+1
print " Su Mo Tu We Th Fr Sa"
for i=1 to val(mid$(LastDay$,4,2))
y=int((i+dow-2)/7)
x=px+(i+dow-2)-y*7
x=4*x
locate x-4,py+y+2
print using("###",i)
next i
return
 
[snoopy]
locate ax, ay+4*gy
print space$(4*gx);" ,-~~-.___."
print space$(4*gx);" / ()=(() \"
print space$(4*gx);" ( ( 0"
print space$(4*gx);" \._\, ,----'"
print space$(4*gx);" ##XXXxxxxxxx"
print space$(4*gx);" / ---'~;"
print space$(4*gx);" / /~|-"
print space$(4*gx);" _____=( ~~ |______ "
print space$(4*gx);" /_____________________\ "
print space$(4*gx);" /_______________________\"
print space$(4*gx);" /_________________________\"
print space$(4*gx);"/___________________________\"
print space$(4*gx);" |____________________|"
print space$(4*gx);" |____________________|"
print space$(4*gx);" |____________________|"
print space$(4*gx);" | |"
return
 
function monthname$(aDate$)
month=val(aDate$)
monthname$=word$("January February March April May June July August September October November December",month)
end function
</lang>
 
{{out}}
<pre> 1969
 
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1
5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8
12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15
19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22
26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29
30 31
 
 
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
27 28 29 30 25 26 27 28 29 30 31 29 30
 
 
 
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
 
 
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
 
 
,-~~-.___.
/ ()=(() \
( ( 0
\._\, ,----'
##XXXxxxxxxx
/ ---'~;
/ /~|-
_____=( ~~ |______
/_____________________\
/_______________________\
/_________________________\
/___________________________\
|____________________|
|____________________|
|____________________|
| |
 
</pre>
 
 
=={{header|Lingo}}==