. , , ,

,,,

- " " Prolog — ,

CODE=12050

/* **************************

* ߠ *

* *

* ࠠ *

* *

**************************

*/

domains

z,i,n,n1,kol,tkol,tel,faks=integer

prod,adr,j=symbol

database -svod1

svod1(n,j,kol,tkol,adr,tel,faks)

database -lolo

lolo(n,prod,kol,i,adr,tel,faks)

database -kuku

kuku(n,prod,kol,tkol,j,i,i)

database-svod

svod(n,prod,kol,tkol,adr,tel,faks)

predicates

start

patch

load

select(i)

sel(i,i)

process(i)

procedure(i)

sve(i)

lod(i)

repeat

goal

start.

clauses

/* */

start:-

makewindow(1,2,7," ",0,0,25,80),

clearwindow,

load,

patch.

/* */

patch:-

repeat,

cursor(7,0),

write(" 0 - pp... "),nl,

write(" 1 - "),nl,

write(" 2 - "),nl,

write(" 3 - "),nl,

write(" 4 - "),nl,

write(" 5 - "),nl,

write(" 6 - "),nl,

write(" 7 - "),nl,

write(" 8 - -"),nl,

write(" 9 - "),nl,

write(" =>"),

readint(Choice),

Choice >= 0,

Choice < 10,

clearwindow,

process(Choice),

clearwindow,

Choice = 9,

retractall(_),

removewindow.

/* */

load:-

existfile("kot.dat"),

consult("kot.dat"),

cursor(1,2),

write(" ").

load:-

cursor(1,2),

write(" ").

/*pp */

process(7):-

makewindow(1,2,7," ",0,0,25,80),

nl,

write(" 𠠠 :"),readint(K),nl,

write(" :"),readln(O),nl,

write(" :"),readint(I),nl,

write(" :"),readint(Y),nl,

write(" :"),readln(T),nl,

write(" :"),readint(V),nl,

write(" :"),readint(A),nl,

N1=K,PROD1=O,KOL1=I,TKOL1=Y,ADR1=T,TEL1=V,FAKS1=A,

assertz(svod(N1,PROD1,KOL1,TKOL1,ADR1,TEL1,FAKS1)),

removewindow,

fail.

/* -*/

process(8):-

makewindow(1,2,7,"-",0,0,25,80),

nl,

write(" :"),readint(A),nl,nl,

svod(N,PROD,KOL,TKOL,ADR,TEL,FAKS),

A=N,

write(" 蠠 :"),write(A),nl,

write(" :"),write(PROD),nl,

write(" :"),write(KOL),nl,

write(" :"),write(TKOL),nl,

write(" :"),write(ADR),nl,

write(" :"),write(TEL),nl,

write(" :"),nl,nl,nl,nl,nl,

write(" "),

readchar(_),

removewindow,

!.

process(8):-

write(" ."),

write(" "),nl,nl,nl,

write(" :"),

readint(A),nl,

A=N1,

write(" ࠠ :"),readln(F),nl,

write(" :"),readint(Y),nl,

write(" :"),readint(J),nl,

write(" :"),readln(G),nl,

write(" :"),readint(E),nl,

write(" :"),readint(Z),nl,

PROD1=F,KOL1=Y,TKOL1=J,ADR1=G,TEL1=E,FAKS1=Z,

assertz(svod(N1,PROD1,KOL1,TKOL1,ADR1,TEL1,FAKS1)),

removewindow,

fail.

/*pp pp*/

process(0):-

makewindow(1,2,7," pp...",0,0,25,80),

write(" p-p "),nl,nl,

write(" 堠 "),nl,nl,

write(" -TURBO-PROLOG v.2.0. "),nl,nl,

write(" p: .. "),nl,nl,

write(" , p.-1-94 () 1995 . "),nl,nl,nl,nl,

write(" "),

readchar(_),

removewindow.

/* */

process(1):-

makewindow(1,2,7,"pp ",0,0,25,80),

nl,

select(N),

X=N,

svod(X,PROD,KOL,TKOL,ADR,TEL,FAKS),

write(" 蠠 :"),write(N),nl,

write(" ࠠ :"),write(PROD),nl,

write(" :"),write(KOL),nl,

write("  :"),write(TKOL),nl,

write(" :"),write(ADR),nl,

write(" :"),write(TEL),nl,

write(" :"),write(FAKS),nl,

nl,

write(" :"),readln(PROD1),

write(" :"),readint(KOL1),

write(" :"),readint(TKOL1),

write(" :"),readln(ADR1),

write(" :"),readint(TEL1),

write(" :"),readint(FAKS1),

X1=X,

retract(svod(X,PROD,KOL,TKOL,ADR,TEL,FAKS)),

assert(svod(X1,PROD1,KOL1,TKOL1,ADR1,TEL1,FAKS1)),

!,

removewindow.

/* */

process(2):-

makewindow(1,2,7," ",0,0,25,80),

nl,

select(N),

X=N,

svod(X,PROD,KOL,TKOL,ADR,TEL,FAKS),

retract(svod(X,PROD,KOL,TKOL,ADR,TEL,FAKS)),!,

removewindow.

/* */

process(3):-

makewindow(1,2,7,"p ",0,0,25,80),

nl,

write("____________________________________________________________________________!"),

write(" "),

nl,

write("----------------------------------------------------------------------------!"),

nl,

write("!!! ! ! !"),

nl,

write("! ! !!-! 񠠠 ! ! !"),

nl,

write("-----------------------------------------------------------------------------"),

nl,

svod(N,PROD,KOL,TKOL,ADR,TEL,FAKS),

cursor(Z,_),

cursor(Z,0),write(N),

cursor(Z,7),write(PROD),

cursor(Z,18),write(KOL),

cursor(Z,23),write(TKOL),

cursor(Z,33),write(ADR),

cursor(Z,55),write(TEL),

cursor(Z,67),write(FAKS),

cursor(Z,77),write("!"),

nl,

fail.

process(3):-

write("-----------------------------------------------------------------------------"),

nl,

write(" "),

readchar(_),

removewindow.

/* */

process(4):-

nl,

makewindow(2,15,4,"",5,5,20,70),

write("1 - "),nl,

write("2 - kot.dat"),nl,

write("3 - "),nl,

write("==>"),

readint(C),

C>0,C<4,

lod(C),

!,

removewindow.

/* */

process(5):-

nl,

makewindow(2,15,4,"",5,5,20,70),

write("1 - "),nl,

write("2 - kot.dat"),nl,

write("3 - "),nl,

write("==>"),

readint(I),

I>0,I<4,

sve(I),!,

removewindow.

/* */

process(6):-

nl,

makewindow(3,2,7," ",0,0,25,80),

write("1 - "),nl,

write("2 - "),nl,

write("3 - "),nl,

write("4 - "),nl,

write("==>"),

readint(O),

O>0,O<5,

procedure(O),

removewindow.

process(_).

/* */

procedure(1):-

makewindow(1,2,7," ",0,0,25,80),

nl,

cursor(7,10),

retractall(_,svod1),

nl,

write(" , "),

nl,

write(" :"),

readln(X),

svod(N,PROD,KOL,TKOL,ADR,TEL,FAKS),

S=PROD,

S=X,

N1=N,KOL1=KOL,TKOL1=TKOL,ADR1=ADR,TEL1=TEL,FAKS1=FAKS,

assert(svod1(N1,S,KOL1,TKOL1,ADR,TEL,FAKS)),

fail.

procedure(1):-

write(" "),nl,

write("----------------------------------------------------------------------------!"),

nl,

write("!!! ! ! !"),

nl,

write("! ! !!-! 񠠠 ! ! !"),

nl,

write("-----------------------------------------------------------------------------"),

nl,

svod(N,S,KOL,TKOL,ADR,TEL,FAKS),

N1=N,

cursor(Z,_),

cursor(Z,0),write(N1),

cursor(Z,7),write(S),

cursor(Z,18),write(KOL),

cursor(Z,23),write(TKOL),

cursor(Z,33),write(ADR),

cursor(Z,55),write(TEL),

cursor(Z,67),write(FAKS),

cursor(Z,77),write("!"),

nl,

fail.

procedure(1):-

write("-----------------------------------------------------------------------------"),

save("now.dat",svod1),

nl,

write(" now.dat"),

nl,

write(" "),

readchar(_),

removewindow,

!.

procedure(1):-

write("-----------------------------------------------------------------------------"),

nl,

write(" "),

nl,

write(" "),

readchar(_),

makewindow(1,2,7," ",0,0,25,80).

procedure(2):-

makewindow(1,2,7," ",0,0,25,80),

nl,

cursor(7,10),

retractall(_,lolo),

nl,

write(" , "),nl,

write(" :"),

readint(X),

svod(N,PROD,KOL,TKOL,ADR,TEL,FAKS),

S=TKOL,

S>=X,

N1=N,PROD1=PROD,KOL1=KOL,ADR1=ADR,TEL1=TEL,FAKS1=FAKS,

assert(lolo(N1,PROD1,KOL1,S,ADR1,TEL1,FAKS1)),

fail.

procedure(2):-

write(" "),nl,

write("-----------------------------------------------------------------------------"),

nl,

write("!!! ! ! !"),

nl,

write("! ! !!-! 񠠠 ! ! !"),

nl,

write("-----------------------------------------------------------------------------"),

nl,

lolo(N,PROD,KOL,S,ADR,TEL,FAKS),

N1=N,

cursor(Z,_),

cursor(Z,0),write(N1),

cursor(Z,7),write(PROD),

cursor(Z,18),write(KOL),

cursor(Z,23),write(S),

cursor(Z,33),write(ADR),

cursor(Z,55),write(TEL),

cursor(Z,67),write(FAKS),

cursor(Z,77),write("!"),

nl,

fail.

procedure(2):-

write("-----------------------------------------------------------------------------"),

save("now1.dat",lolo),

nl,

write(" now1.dat"),

nl,

write(" "),

readchar(_),

removewindow,

!.

procedure(2):-

write("-----------------------------------------------------------------------------"),

nl,

write(" "),

nl,

write(" "),

readchar(_),

makewindow(1,2,7," ",0,0,25,80).

procedure(3):-

makewindow(1,2,7," ",0,0,25,80),

nl,

cursor(7,10),

retractall(_,kuku),

nl,

write(" , "),

nl,

write(" :"),

readln(X),

readint(Y),

readint(Z),

svod(N,PROD,KOL,TKOL,ADR,TEL,FAKS),

S=ADR,

D=TEL,

C=FAKS,

S=X,

D=Y,

C=Z,

N1=N,PROD1=PROD,KOL1=KOL,TKOL1=TKOL,

assert(kuku(N1,PROD1,KOL1,TKOL1,S,D,C)),

fail.

procedure(3):-

write(" "),nl,

write("----------------------------------------------------------------------------!"),

nl,

write("!!! ! ! !"),

nl,

write("! ! !!-! 񠠠 ! ! !"),

nl,

write("-----------------------------------------------------------------------------"),

nl,

kuku(N,PROD,KOL,TKOL,S,D,C),

N1=N,

cursor(Z,_),

cursor(Z,0),write(N1),

cursor(Z,7),write(PROD),

cursor(Z,18),write(KOL),

cursor(Z,23),write(TKOL),

cursor(Z,33),write(S),

cursor(Z,55),write(D),

cursor(Z,67),write(C),

cursor(Z,77),write("!"),

nl,

fail.

procedure(3):-

write("-----------------------------------------------------------------------------"),

save("now2.dat",svod1),

nl,

write(" now2.dat"),

nl,

write(" "),

readchar(_),

removewindow,

!.

procedure(3):-

write("-----------------------------------------------------------------------------"),

nl,

write(" "),

nl,

write(" "),

readchar(_),

makewindow(1,2,7," ",0,0,25,80).

/* */

sve(1):-

write(" :"),

readln(N),

save(N),

write(" "),

beep,

!.

sve(1):-

write(" , "),

readchar(_).

sve(2):-

save("kot.dat").

sve(3).

/* */

lod(1):-

retractall(_),

write(" :"),

readln(N),

existfile(N),

consult(N),

write(" "),

beep,

!.

lod(1):-

nl,

write(" "),nl,

write(" "),

readchar(_).

lod(2):-

retractall(_),

existfile("kot.dat"),

consult("kot.dat"),

write(" "),

beep,

!.

lod(2):-

write(" kot.dat "),nl,

write(" "),

readchar(_).

lod(3).

repeat.

repeat:- repeat.

/* */

select(N):-

nl,

write("1 - "),nl,

write("2 - "),nl,

write("3 - "),nl,

write("4 - "),nl,

write("5 - "),nl,

write("6 - "),nl,

write("7 - "),nl,

write("==>"),

readint(X),

sel(X,N).

sel(1,N):-

nl,

write(" 蠠 :"),

readint(N),

svod(M,_,_,_,_,_,_),

M=N.

sel(1,N):-

N=0.

sel(2,N):-

nl,

write(" :"),

readln(L),

svod(Z,L,_,_,_,_,_),

N=Z.

sel(2,N):-

N=0.

sel(3,N):-

nl,

write(" : "),

readint(F),

svod(Z,_,F,_,_,_,_),

N=Z.

sel(3,N):-

N=0.

sel(4,N):-

nl,

write(" :"),

readint(Q),

svod(Z,_,_,Q,_,_,_),

N=Z.

sel(4,N):-

N=0.

sel(5,N):-

nl,

write(" (.):"),

readln(W),

svod(Z,_,_,_,W,_,_),

N=Z.

sel(5,N):-

N=0.

sel(6,N):-

nl,

write(" :"),

readint(E),

svod(Z,_,_,_,_,E,_),

N=Z.

sel(6,N):-

N=0.

sel(7,N):-

nl,

write(" :"),

readint(A),

svod(Z,_,_,_,_,_,A),

N=Z.

sel(7,N):-

N=0.

CODE=12050 /* ************************** * ߠ * * * * ࠠ * * * ***************

 

 

 

! , , , .
. , :