109. Re: [TSabc:43]初心者向け言語の比較の参考に(PostScript の場合)


番号順一覧Top スレッド順一覧Top
作者: Tsutomu Hiroshima
日時: 2002/4/15(08:57)
バグがありました.訂正します.

/buf 16 string def
/total 0 def
/fd (%stdin) (r) file def
{ %loop
  /str fd buf readline pop def
  /num 0 def
  /sgn 1 def
  str 0 get 45 eq { %if
    /sgn -1 def
    /str str 1 str length 1 sub getinterval def
  } if
  str 0 get 43 eq { %if
    /str str 1 str length 1 sub getinterval def
  } if
  0 1 str length 1 sub { %for
    str exch get 48 sub
    /c exch def
    c 0 lt c 10 ge or { exit } if
    /num num 10 mul def
    /num num c add def
  } for
  /num num sgn mul def
  num 0 eq { exit } if
  /total total num add def
} loop
total ==
quit

-----------------------------
	廣島 勉
	(tsutomu@...)
前の発言: 108. Re: [TSabc:43]初心者向け言語の比較の参考に(PostScript の場合) [Tsutomu Hiroshima] 2002/4/15(08:23)
後の発言: 110. Re: 初心者向け言語の比較の参考に(PostScript の場合) [閑舎] 2002/4/15(12:58)
親発言: 108. Re: [TSabc:43]初心者向け言語の比較の参考に(PostScript の場合) [Tsutomu Hiroshima] 2002/4/15(08:23)
子発言: 110. Re: 初心者向け言語の比較の参考に(PostScript の場合) [閑舎] 2002/4/15(12:58)