Add more prax2 programs
This commit is contained in:
parent
2db2cfea06
commit
5b4b4271fd
23
prax2/calc2.hs
Normal file
23
prax2/calc2.hs
Normal file
@ -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"
|
4
prax2/notBool.hs
Normal file
4
prax2/notBool.hs
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env runghc
|
||||
|
||||
notBool :: Bool -> Bool
|
||||
notBool x = not x
|
Loading…
Reference in New Issue
Block a user