Advertisement
ChristianBizu

Programa v1.1

Jun 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --data Producto = (Nombre String , Precio Float)
  2. data Temperatura = Celsius(Float) | Farenheit(Float)
  3. type Producto = (String,String)
  4. data IO = Producto(Producto)
  5.  
  6. opcion1 = "1.Introducir un producto"
  7. opcion2 = "2.Estadísticas"
  8. opcion3 = "3.Salir"
  9.  
  10. introducir1 = "Introduzca un nombre:"
  11. introducir2 = "Introduzca un precio:"
  12.  
  13. opciones = do
  14.     putStrLn opcion1
  15.     putStrLn opcion2
  16.     putStrLn opcion3
  17.  
  18. introducirProducto = do
  19.         putStrLn introducir1
  20.         nombreProducto <- getLine
  21.         putStrLn introducir2
  22.         precioProducto <- getLine
  23.         main
  24.        
  25.    
  26. main = do
  27.     putStrLn "Introduzca una opcion:"
  28.     opciones
  29.     name <- getLine
  30.     if name == ['1']
  31.     then introducirProducto
  32.     else
  33.         if name == ['3']
  34.         then return ()
  35.         else (do
  36.             putStrLn  $ ("Hey " ++ name ++ ", you rock!");
  37.             main)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement