年間カレンダー
Posted feedbacks - PostScript
PostScript 版です。A4一枚に出力します。
年号を変更するときには先頭部の書き換えが必要です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | %!PS
/Year 2008 def
% Design Parameters
/Columns 3 def
/FontSize 10 def
20 600 /Y0 exch def /X0 exch def % Top Left Position
200 150 /VMY exch def /VMX exch def % Size of 1 Month
20 13 /VY exch def /VX exch def % Size of 1 Day
% Color / Font Settings , Tables
% [ Sunday Monday .... Saturday ]
/WColorR { [1 0 0 0 0 0 0] } def
/WColorG { [0 0 0 0 0 0 0] } def
/WColorB { [0 0 0 0 0 0 1] } def
/WFont { [ /Times-Bold /Times-Roman /Times-Roman /Times-Roman /Times-Roman
/Times-Roman /Times-Bold ] } def
/MonthName {[(January) (February) (March) (April) (May) (June)
(July) (Augusut) (September) (October) (November) (December)]} def
/WeekdayName {[(Sun) (Mon) (Tue) (Wed) (Thu) (Fri) (Sat)]} def
/MDays { [31 28 31 30 31 30 31 31 30 31 30 31] } def
% -------------------------------------------------------------------------
/MonthFont {/Times-Roman findfont FontSize 2 mul scalefont setfont 0 setgray} \
def
/SetFont { dup WFont exch get findfont FontSize scalefont setfont
dup WColorR exch get exch dup WColorG exch get exch
WColorB exch get setrgbcolor
} def
/POS { VY mul YM0 exch sub exch VX mul XM0 add exch moveto } def
/POS2 { WOffset add dup 7 mod exch 7 idiv 2 add POS } def
/LeapYear {dup 400 mod 0 eq exch dup 100 mod 0 eq not
exch 4 mod 0 eq and or } def
/MDay { dup MDays exch get exch 1 eq Year LeapYear and { 1 add } if } def
/ZellerFomula {
dup 2 le { 12 add exch 1 sub exch } if
13 mul 8 add 5 idiv exch dup 5 mul 4 idiv exch dup 100 idiv exch
400 idiv exch sub add add 1 add 7 mod
} def
/DrawTitle {
X0 150 add Y0 50 add moveto
/Times-Italic findfont 100 scalefont setfont
Year 4 string cvs show
} def
% -------------- Main Program -----------------
DrawTitle
0 1 11 {
/Month exch def
MonthFont
/XM0 X0 Month Columns mod VMX mul add def
/YM0 Y0 Month Columns idiv VMY mul sub def
XM0 YM0 moveto
Month 1 add 4 string cvs show
MonthName Month get 10 0 rmoveto show
0 1 6 {
dup SetFont
dup 1 POS
WeekdayName exch get show
} for
/WOffset Year Month 1 add ZellerFomula def
0 1 Month MDay 1 sub {
dup POS2
dup WOffset add 7 mod SetFont
1 add 3 string cvs show
} for
grestore
} for
showpage
|


186
#4884()
Rating4/4=1.00
nを入力としてn年の年間カレンダーを返すプログラムを作ってください 少なくとも日曜日と土曜日が判別出来るようにしてください 出力は標準出力でもファイルでも構いません デザインは各自のお好みで 出力例1: (y-calendar 2008)=> #=Saturday, @=Sunday 2008/1 1 2 3 4 #5 @6 7 ... 2008/2 1 #2 @3 4 5 6 7 ... ... 2008/12 1 2 3 4 5 #6 @7 ... 出力例2: (y-calendar 2008)=> M T W T F S S M 2008/ 1 1 2 3 4 5 6 7 ... 2008/ 2 1 2 3 4 ... ... 2008/12 1 2 3 4 5 6 7 8 ... 出力例3: (y-calendar 2008)は2008.htmlを出力する 2008.htmlの中身 ---- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>2008 calendar</title> <style type="text/css"> * {font-family: monospace;} span {margin: 0px 3px;} span.sunday {color:red;font-weight:bold;} span.saturday {color:blue;font-weight:bold;} dd ul li{display:inline;} </style> </head> <body> <h1>2008 calendar</h1> <dl> <dt>2008/1</dt> <dd><ul> <li><span class="weekday">1</span></li> <li><span class="weekday">2</span></li> <li><span class="weekday">3</span></li> <li><span class="weekday">4</span></li> <li><span class="saturday">5</span></li> <li><span class="sunday">6</span></li> ... </ul></dd> ... </dl> </body> </html> ----[ reply ]