Input/Output for lines of text: Difference between revisions
Content added Content deleted
(C++ entry) |
(Haskell - Update to read N lines) |
||
Line 414: | Line 414: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang Haskell> |
<lang Haskell>import Control.Monad |
||
main = do |
|||
doStuff = putStrLn |
|||
number <- getLine |
|||
main = getContents >>= mapM_ doStuff.tail.lines |
|||
input <- replicateM (read number) getLine |
|||
⚫ | |||
mapM_ putStrLn input |
|||
</lang>'''Input:''' |
|||
<pre> |
|||
3 |
|||
hello |
|||
hello world |
|||
Pack my Box with 5 dozen liquor jugs |
|||
⚫ | |||
{{out}} |
|||
<pre> |
|||
hello |
|||
hello world |
|||
Pack my Box with 5 dozen liquor jugs |
|||
</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |