Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search variable

Status
Not open for further replies.

vero2390

Programmer
Jul 14, 2011
2
0
0
IT
sorry for my English

this is my code
stampa_diagnosi(X) :- gia_chiesto(S, 'si'), sintomo(S, M), not(sintomo(S, X)), M \= X,
nl, write('Una possibile diagnosi è: '), write(X), nl,

write('il paziente ha un peso minore di 65 KG? (1, 2, 3) '),nl,read(X),peso(P), nl.

peso(1) :- write('Possibile cura: '), cura1(X), nl, write(' ----- '), nl,spiegacome.
peso(2) :- write('Possibile cura: '), cura2(X), nl, write(' ----- '), nl,spiegacome.
peso(3) :- write('Possibile cura: '), cura3(X), nl, write(' ----- '), nl,spiegacome.

cura1(centaurea_minore) :- write('La cura è di 10 gocce .').

cura2(centaurea_minore) :- write('La cura è di 30 gocce .').

cura3(centaurea_minore) :- write('La cura è di 40 gocce .').

cura1(agnocasto) :- write('La cura è di 10 gocce .').

cura2(agnocasto) :- write('La cura è di 30 gocce .').

cura3(agnocasto) :- write('La cura è di 40 gocce .').

how do I maintain the value of X of diagnosis that is lost when I ask the question of the weight of the patient?

My question requires me once I found the cure based on the weight I have to select the right one as I do??

Obviously I have a lot of care and care for each three solutions

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top