%trace
domains
marklist=integer*
database
students(symbol,symbol,real,marklist)
predicates
choice(integer)
repeat
clauses
repeat.
repeat :-
repeat.
choice(1) :-
write("Enter Student Name : "),
readln(SNAME),
students(SNAME,AREA,PHNO,MARKS),
write(SNAME), write(" "), write(AREA), write(" "),
write(PHNO), write(" "), write(MARKS),
fail.
choice(2) :-
write("Enter Phone No : "),
readreal(PHNO),
students(SNAME,AREA,PHNO,MARKS),
write(SNAME), write(" "), write(AREA), write(" "),
write(PHNO), write(" "), write(MARKS),
fail.
choice(0) :- !.
goal
assert(students("hemal","navrangpura",123456,[50,45,40])),
assert(students("shashank","ankur",234567,[41,42,32])),
assert(students("nilay","vastrapur",345678,[34,43,35])),
repeat,
write("\n1. Search by Name"),
write("\n2. Search by Phone NO"),
write("\n0. Exit"),
write("\n\nEnter your choice : "),
readint(CH),
choice(CH).