home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH12EX07.PRO < prev    next >
Encoding:
Prolog Source  |  1990-03-26  |  653 b   |  31 lines

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.    
  5. domains
  6.    person = p(name, age, telno, job)
  7.    age = integer
  8.    telno, name, job = string
  9.  
  10. predicates
  11.    readperson(person)
  12.    run
  13.  
  14. goal
  15.    run.
  16.  
  17. clauses
  18.    readperson(p(Name, Age, Telno, Job)) :-
  19.       write("Which name ? "), readln(Name),
  20.       write("Job ?"), readln(Job),
  21.       write("Age ?"), readint(Age),
  22.       write("Telephone no ?"), readln(Telno).
  23.  
  24.    run :-
  25.       readperson(P), nl, write(P), nl, nl,
  26.       write("Is this compound object OK (y/n)"),
  27.       readchar(Ch), Ch='y'.
  28.  
  29.    run :-
  30.       nl, nl, write("Alright, try again"), nl, nl, run.
  31.