Hello,

I'm new to haskell and want to write a small program for some  winder 
calcucations. I want to input 10-15 values and based on this input
doing some calculations. After this calculations I want to print out the
results.

My problem is: How can I get the input values into the calculations and back
the result to the output.

In an other language I would use global variables for this. So what should I
use in haskell?

An other point is that I want to separate the input from the calculations and
the output.

How can I achieve this with haskell? Modules? Data types?



See some pseudo code below.


inputvalues  ::  IO()
inputvalues = do  hSetBuffering stdout NoBuffering
              putStr "Berechnung Bremsgenerator \n\n"
              ve <- readNum  "Bitte Maschinengeschwindigkeit (m/min) angeben: "
              de <- readNum "Bitte Durchmesser der vollen Rolle eingeben (mm): "
              dewalze <- readNum "Bitte Durchmesser der Walze eingeben (mm): "
              dewand <- readNum "Bitte Wandstaerke der Walze eingeben (mm): "

              and so on ..............


readNum :: String -> IO Float
readNum text  = do putStrLn text
                   readLn


-- calculations

nvr :: Float-> Float-> Float
nvr ve de     =  ve / de /pi *1000

pzugmin :: Float-> Float-> Float->Float
pzugmin ve femin be = 1.666 * ve * femin * be * 0.00000001

pzugmax :: Float-> Float-> Float->Float
pzugmax ve femax be = 1.666 * ve * femax * be * 0.00000001

and so on ..............

outputvalues = do  putStr "\n\nErgebnisse Bremsgenerator \n\n"
                   putStr "Drehzahl leere Trommel: "
                   putStr(show(round(nvr)))
                   putStr " U/min \n"
                   putStr "Drehzahl volle Trommel: "
                   putStr(show(round(drehbgmax)))
                   putStr " U/min \n"

                  and so on ......................




Thanks Thomas

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to