Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

ProLog Program to search record by name and phone number

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 3782

Program to search record by name and phone number.

Code for ProLog Program to search record by name and phone number in Artificial Intelligence

%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).
  
Share: 


Didn't find what you were looking for? Find more on ProLog Program to search record by name and phone number Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of ProLog Program to search record by name and phone number is from India.
 
View All Articles

 

Other Interesting Articles in Artificial Intelligence:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!