06 2012 档案
摘要:1.Haskell风格的main = putStr (s ++ show s);s=" main = putStr (s ++ show s);s="--我在想假如把s串放在最前面该怎么写。2.C风格的,利用printf函数import Text.Printfs="import Text.Printf%cs=%c%s%c;main = printf s (13::Int) (34::Int) s (34::Int)";main = printf s (13::Int) (34::Int) s (34::Int)
阅读全文
摘要:--打印直角三角形。import Control.Monadmain n = mapM_ print (map (\x -> replicate x '*') [1..n])--打印等腰三角形,第n行有2n-1个*号。import Control.Monadmain n = mapM_ print (map (\x -> (replicate (n-x) ' ')++(replicate (2*x-1) '*')++(replicate (n-x) ' ')) [1..n])
阅读全文

浙公网安备 33010602011771号