
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