Documente Academic
Documente Profesional
Documente Cultură
Chiinau 2012
Codul Sursa :
x 2 dac t 0
f x, y, t y 2 dac t 1
f x, y, t 2 dac t 1
Codul sursa :
PREDICATES
f(integer,integer,integer,integer)
CLAUSES
f(X,_,T,F):-T=0,F=X*X.
f(_,Y,Y,F):-Y=1,F=Y*Y.
f(X,Y,T,F):-T>1,TT=T-3,f(X,Y,TT,F).
GOAL
write("introduceti X,Y,T"),
readint(X),
readint(Y),
readint(T),
f(X,Y,T,F),
write("Valoarea funtiei este ",F)
III.
%autoaa(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc):auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret),Cul=negru,Vol>2.0,Vol<3.0,write(Ma,' ',Se,'
',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,' ',Loc),nl,fail.
%autoaa(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc):auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret),Cul=negru,An>1995,Vol>2.0,Vol<3.0,Pret<2000,
write(Ma,' ',Se,' ',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,' ',Loc),nl,fail.
%------------auto_familie:auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc),Vol>3.0,Vit<200,Cut=manual,Loc>4,write(
Ma,' ',Se,' ',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,' ',Loc),nl,fail.
auto_anticar:auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc),An<1950,Vit<100,Cut=manual,Pret>40000,
write(Ma,' ',Se,' ',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,' ',Loc),nl,fail.
auto_prest:auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc),An>2005,Vit>200,Cut=automat,Pret>11000
0,Acc=yes,write(Ma,' ',Se,' ',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,' ',Loc),nl,fail.
auto_sport:auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc),An>2000,Vit>180,Cut=automat,Vol>2.0,Ac
c=yes,Pret<20000,write(Ma,' ',Se,' ',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,'
',Loc),nl,fail.
auto_dame:auto(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret,Loc),An>1990,Vit<200,Cut=automat,Vol<2.0,Ac
c=yes,Cul=roz,write(Ma,' ',Se,' ',An,' ',Vit,' ',Com,' ',Cut,' ',Cul,' ',Vol,' ',Acc,' ',Pret,' ',Loc),nl,fail.
GOAL
%autoaa(Ma,Se,An,Vit,Com,Cut,Cul,Vol,Acc,Pret).
%auto_anticar.
%auto_prest.
%auto_sport.
%auto_dame.
auto_familie
Rezultatele programului: