diff --git a/prax2/calc2.hs b/prax2/calc2.hs new file mode 100644 index 0000000..961ac4e --- /dev/null +++ b/prax2/calc2.hs @@ -0,0 +1,23 @@ + +getFloat :: IO Float +getFloat = do + readLn :: IO Float + +main :: IO () +main = do + putStr "Sisesta 1. nr: " + val1 <- getFloat + putStr "Sisesta 2. nr: " + val2 <- getFloat + putStr "Sisesta 3. nr: " + val3 <- getFloat + putStr "Sisesta tehe(+-*/): " + tehe <- getLine + + putStr "Tulemus: " + case tehe of + "+" -> putStrLn $ (show(val1 + val2 + val3)) + "-" -> putStrLn $ (show(val1 - val2 - val3)) + "*" -> putStrLn $ (show(val1 * val2 * val3)) + "/" -> putStrLn $ (show(val1 / val2 / val3)) + _ -> putStrLn "Ei oska tehet teha" diff --git a/prax2/notBool.hs b/prax2/notBool.hs new file mode 100644 index 0000000..c5c7a9c --- /dev/null +++ b/prax2/notBool.hs @@ -0,0 +1,4 @@ +#!/usr/bin/env runghc + +notBool :: Bool -> Bool +notBool x = not x