0% found this document useful (0 votes)
92 views2 pages

Week 4 Prolog

The document presents a Prolog program for medical diagnosis that asks patients about their symptoms to determine potential diseases like flu or common cold. It includes functions for user interaction and symptom checking. Additionally, it discusses the advantages and disadvantages of using green and red cuts in Prolog programming.

Uploaded by

227r1a66d8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views2 pages

Week 4 Prolog

The document presents a Prolog program for medical diagnosis that asks patients about their symptoms to determine potential diseases like flu or common cold. It includes functions for user interaction and symptom checking. Additionally, it discusses the advantages and disadvantages of using green and red cuts in Prolog programming.

Uploaded by

227r1a66d8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

WEEK-4

WAP in turbo prolog for medical diagnosis and show the advantages and
disadvantages of green and red cuts.
goonce :-
write("What is the patient's name? "),nl,
readln(Patient),
hypothesis(Patient,Disease),!,
write(Patient),write(" probably has "),
write(Disease),nl,
go;
write("Sorry, I am not in a position to diagnose the disease."), go.

symptom(Patient, fever):-
write("Does"),write(Patient),write(" have a fever (y/n)? "), nl,
response(Reply),
Reply = 'y'.
symptom(Patient, rash):-
write("Does "), write(Patient), write(" have a rash (y/n)? "), nl,
response(Reply),
Reply = 'y'.
symptom(Patient, body_ache):-
write("Does "), write(Patient), write(" have a body ache (y/n)? "), nl,
response(Reply),
Reply = 'y'.
symptom(Patient, runny_nose):-
write("Does "), write(Patient), write(" have a runny nose (y/n)? "), nl,
response(Reply),
Reply = 'y'.

hypothesis(Patient, flu) :-
symptom(Patient, fever),
symptom(Patient, body_ache),
symptom(Patient, rash),
symptom(Patient, runny_nose).
hypothesis(Patient, common_cold) :-
symptom(Patient, body_ache),
symptom(Patient, runny_nose).
response(Reply) :-
read(Reply).

go:-
write("Would you like to try again (y/n)? "),
response(Reply),
Reply = 'y',
goonce.

OUTPUT:-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy