
June 13th, 2006, 05:28 PM
|
 |
Contributing User
|
|
Join Date: Dec 2004
Location: Meriden, Connecticut
|
|
Here is my solution:
Code:
(define password 'a123456)
(define (ask-username)
(display "Account: ")
(read))
(define (ask-password)
(display "Password: ")
(if (equal? password (read))
"Granted!"
"Denied!"))
(define (get-info)
(let ((pas (ask-password))
(acc (ask-username)))
'(acc pas)))
(ask-username) stores whatever the user enters in after Account: into the variable acc.
(ask-password) stores whatever the user enters in after Password: into the variable pas.
(get-info) creates the two variables (acc and pas) and returns a list containing both items.
This is just one solution.
Last edited by Yegg` : June 13th, 2006 at 05:38 PM.
|