
Hello, Can somebody help me My Problem is to define a code for:
cross 7 -- means 7*7 +++++++ ++ ++ + + + + + + + + + + + ++ ++ +++++++
Another Example
cross 13 -- 13*13 +++++++++++++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++ ++ +++++++++++++
Can I use putString ??? Thanks for any help -- View this message in context: http://www.nabble.com/ACross-t1813549.html#a4943328 Sent from the Haskell - Haskell-Cafe forum at Nabble.com.

Not to be the bad guy, but perhaps it's a good idea to remind ourselves of our homework policy.
This? http://www.haskell.org/hawiki/HomeworkHelp
Can I use putString ???
If you mean putStrLn and putStr, then yes. I would first make a function that constructs the string or list of strings (maybe using ++) you need to display, and then call putStr and/or putStrLn the appropriate number of times. Other questions to answer: * Can we safely ignore the case of even numbers?, i.e. cross 2, cross 4, cross 6, etc. * Looking at the output lines, how can we break down or classify them, in terms of numbers of plus signs and areas of spaces? Which lines are similar? etc. Good luck, Jared. -- http://www.updike.org/~jared/ reverse ")-:"

2006/6/19, Jared Updike
* Looking at the output lines, how can we break down or classify them, in terms of numbers of plus signs and areas of spaces? Which lines are similar? etc.
in other words, given 'cross n', what's the relationship between the number of line to produce and 'n' ? and what's the relationship between line number i and 'n' ? bye, vo minh thu

Jenny678 wrote:
Can somebody help me My Problem is to define a code for:
cross 7 -- means 7*7 +++++++ ++ ++ + + + + + + + + + + + ++ ++ +++++++
As always, try to decompose a hard problem into simple steps. It's probably adequate to represent pictures as *> type Picture = [String] then compose your "cross" from six lines. An overlay operator *> over :: Picture -> Picture -> Picture is trivial to write. Creating the lines should be easy, *> replicate :: Int -> a -> [a] from the Prelude and list comprehensions might help.
Can I use putString ???
Of course, but you shouldn't. Creating a cross is a seperate step from putting it on screen. "cross" should probably return a list of Strings or a single String (think "unlines"). In fact, *> cross :: Int -> Picture definitely makes the most sense to me. Udo. -- People with great minds talk about ideas. People with ordinary minds talk about things. People with small minds talk about other people. -- Eleanor Roosevelt
participants (5)
-
Jared Updike
-
Jenny678
-
minh thu
-
Stefan Holdermans
-
Udo Stenzel