jeudi 3 août 2017

Haskell Password Program

I am very new to Haskell and I am attempting to make a simple password program as my first program. I have ran into a problem and I am not very sure on how to fix it. I do not know how to make a second section for the passwords. My guessing attempts have failed so I am asking for help.

main = do 
  putStrLn "Hello, Who are you?"
  name <- getLine --User Input
  putStrLn ("Hey " ++ name ++ ", What's the password?")
  pass <- getLine
  if pass == "12345"
      then putStrLn ("Welcome")
      pw -- Go to password Prompt
      else do
          putStrLn "That is wrong!"
          main --Sent back to beginning
pw = do
putStrLn "What Password do you need?"

I do not know how to switch to asking for which password is needed, I am decently sure I know how to list them. The goal is to ask user which password givin a list of websites such as yahoo and then the user pick one and be told the password. Thanks in advance :D

Aucun commentaire:

Enregistrer un commentaire