home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
prolog
/
library
/
prolo_c
/
exampl23.pro
< prev
next >
Wrap
Text File
|
1986-10-06
|
803b
|
33 lines
/* Program 23 */
/*
This program demonstrates the use of readln
and the extraction of compuound objects from
input lines. If you enter the wrong type for
each item, you must try again.
*/
domains
person = p(name,age,telno,job)
age = integer
telno ,name,job = string
predicates
readperson(person)
run
goal
run.
clauses
readperson(p(Name,Age,Telno,Job)):-
write("Which name ? "),readln(Name),
write("Job ?"),readln(Job),
write("Age ?"),readint(Age),
write("Telephone no ?"),readln(Telno).
run:-
readperson(P),nl,write(P),nl,nl,
write("Is this compound object OK (y/n)"),
readchar(Ch),Ch='y'.
run:-
nl,nl,write("Alright, try again"),nl,nl,run.