knowledgediarybd.com

Your Virtual Knowledge Campus

Starting WithTurbo Prolog

To start turbo prolog ,you must have first setup turbo prolog on your computer.you can download turbo prolog from here.

After download you have to setup.Then For starting with turbo prolog go to your run  option and write the following command or just click turbo prolog icon.

Then you will see a interface like below and on this you have to write a program.To write a program open the following interface and click “alt f”  button for selecting menu of that interface,then write program  code and save then compile & run.After run the program you have to give Goal and finally you will see the output.

Basic Coding Structure Of Turbo Prolog Program:

first prolog program

1. Domains —>control the types of object(6 objects)

2. Predicates –>Relation of the clauses is defined in this section.

3.Clauses –>Express the fact

Six Types of object in turbo Prolog:

  1. char:enclosed between single quotation
  2. integer: Range -3276 to 32767
  3. real: Floating point number 1e^307 to1e^308
  4. string: enclosed between double quotation
  5. symbol: sequence of letter starting with case letters.
  6. file type.

Here is a simple Turbo Prolog Program Code:

/* programm start here*/

domains

disease,indication=symbol

predicates

symptom(disease,indication).

clauses

symptom(chiken_pox,high_fever).

symptom(flu,chillis).

/*program end here */

Goal:symptom(flu,chillis)

Answer: Yes

Here is a another program that that can add odd number

/* Programm start here*/

domains

a,b=integer

predicates

count(a,b)

clauses

count(-1,B).

count(N,B):-

BB=B+N,

NN=N-2,

write(“”,BB)

count(NN,BB),

Goal: (51,0).

/* end of program here*/

[Note:] More Interesting things are waiting to publish.So stay connected with us.

………….Thank You……………

knowledgediarybd.com © 2017
shares