Advertisement
ChristianBizu

Programa v1

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