. , , ,

,,,

- " " — ,

N -1

" -

". .. . -1-95.

1. :

- .

2. :

1

-----------------------------------------------------------------

-----------------------------------------------------------------

Π | || | |

---------------|.| |-------------------||

||| |Р |I |II |III |IV | |

-----------------------------------------------------------------

2 , . 1

: , -, ,

; 2 - : .

.

3. , :

3.1 , , , :

- ,

- ,

- ,

- ,

- ,

- ,

- .

3.2 :

- ,

- ,

- ,

- ,

- ,

- ,

- .

4. :

4.1

4.2 .

5. - :

1.

4.10.96

2. , ,

18.10.96

3.

25.10.96

4. -

15.11.96

5.

29.11.96

6.

13.12.96

7.

20.12.96

/ ../

/ .., -1-95/

@.

.................................. 4

1.

................. 5

2. .......... 5

3. ............. 6

4. ......... 7

5. :

5.1 ........... 8

5.2 ...................... 8

5.3 ................. 9

5.4 ....................10

5.5 .................10

5.6 .....................10

5.7 ................10

6. ........................12

7. ......................18

8.

: ..................18

8.1 ......................20

8.2 ......................20

8.3 ..................20

8.4 ........................20

................................21

.........................22

, , .

. .

: , ( " ") " ".

( 1 2) (), . .

( 3-7) : , .. . " ". Turbo-Prolog v2.0.

" ".

1.

- , . : " ", , .

- , . , , .

. :

- ( @consult );

- ( @save );

- ( @asserta assertz );

- ( @retract) .

.

@2.

() - , . , . , . , ( ). , , . . - :

-------------------------------------------

| | | | |

-------------------------------------------

⠠ 000-00-00

⠠ 𠠠 111-11-11

-------------------------------------------

, , . .

, , .

:

__(_) .

@DATABASE. . : , , ..

@3.

. , , .. , . :

0 - pp... -

1 - -

2 - -

3 - -

4 - -

5 - -

6 - -

7 - -

8 - -

. :

ڗ

—

ڗ

×

ڗ

×

ڗ

×

ڗ

×

ڗ

×

—

ڗ

× ALEX.DAT

ڗ

ڗ

×

—

ڗ

× ALEX.DAT

ڗ

ڗ

×

—

ڗ

×

ڗ

× " "

ڗ

ڗ

×

ڗ

@4.

, .. , :

A ALEX - " "

ڗ

—

ڗ

-

, ⠠

—

ڗ

—

ڗ

—

ڗ

REPEAT

, . . 7. , . .

@5.

@5.1 @(PATH)

. . , ..

, . , , ().

:

ڗ З

0 - pp...

1 -

2 -

3 -

4 -

5 -

6 -

7 -

8 -

>_

@Choice 0 8, @process(Choice). @process(Choice) @Choice .

@ 5.2

ALEX - " " . .

@ A (LOAD)

.

"alex.dat" @existfile , @ALEX @consult. , .

A

@PROCESS(4). :

ڗ

ALEX.DAT - 1

- 2

>_

,

.. .

@WHAT .

, @LOAD.

. @FNAME , @ALEX, @retractall(_,alex), .

@5.3

. @PROCESS(1).

@ALEX 񠠠 @alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST) , @WHAT ,@ (1 0) (1) (0). :

ڗ

:⠠ (FIO)

: (NAME)

: (OT)

: (KAF)

a :300 (NIR)

I :50 (K1)

II :40 (K2)

III :50 (K3)

IV :60 (K4)

:200 (TOTAL)

:100 (OST)

? (1- 0-)

. .

. .

, .

.

@5.4

@PROCESS(2). , .

@5.5

@ALEX.

@PROCESS(7).

@ALEX.  @assertz(alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST)).

@5.6

ALEX - " "

@ALEX . -

.5.7.

.

-

. -

@PROCESS(3).

( ) -

@alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST)

@ALEX

. -

@CURSOR.

.

@ALEX1 . - @viewbase .

@5.7

-

. -

@PROCESS(6) .

:

ڗ

- 1

' ' - 2

- 3

>_

,

.. ,

.

-

@WHAT -

.

A

@ALEX

@ALEX1 , -

. -

@newbase(1) , . -

@ @viewbase .

A ' '

@ALEX

@ALEX1 , -

.

@newbase(2) ,

. @

@viewbase .

"ALEX1.DAT".

@6.

DOMAINS

i=integer

s=symbol

DATABASE-alex

alex(s,s,s,s,i,i,i,i,i,i,i)

DATABASE-alex1

alex1(s,s,s,s,i,i,i,i,i,i,i)

PREDICATES

start

load

path

process(i)

newbase(i)

repeat

viewbase

GOAL

start.

CLAUSES

/* */

start:-

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

clearwindow,

load,

path.

/* */

load:-

existfile("alex.dat"),

consult("alex.dat",alex),

cursor(1,2),

write(" ").

load:-

cursor(1,2),

write(" ").

path:-

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(" >"),

readint(Choice),

Choice >= 0,

Choice < 9,

clearwindow,

process(Choice),

clearwindow,

Choice = 9,

retractall(_),

removewindow.

/* */

process(0):-

makewindow(1,7,4," pp...",10,10,10,60),nl,

write(" p-p "),nl,

write(" a Р "),nl,

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

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

write(" , p.-1-95 (C) 1996 . "),nl,nl,

write(" "),

readchar(_),

removewindow.

/* */

process(2):-

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

alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST),

clearwindow,

write(":",FIO),nl,

write(":",NAME),nl,

write(":",OT),nl,

write(" :",KAF),nl,

write("a :",NIR),nl,

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

write(" II :",K2),nl,

write(" III :",K3),nl,

write(" IV :",K4),nl,

write(" :",TOTAL),nl,

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

attribute(4),

write(" ? (1- 0-) >"),attribute(7),

readint(WHAT),

WHAT=1,

nl,

retract(alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST)),

clearwindow;

WHAT=0,removewindow.

/* */

process(3):-

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

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

write(" Π | || | |"),nl,

write("------------|.| |-------------------||"),nl,

write(".||| |Р |I |II |III |IV | |"),nl,

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

alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST),

cursor(Z,_),

cursor(Z,0),write(FIO),

cursor(Z,8),write(NAME),

cursor(Z,17),write(OT),

cursor(Z,26),write(KAF),

cursor(Z,34),write(NIR),

cursor(Z,43),write(K1),

cursor(Z,48),write(K2),

cursor(Z,53),write(K3),

cursor(Z,58),write(K4),

cursor(Z,63),write(TOTAL),

cursor(Z,69),write(OST),nl,

fail.

process(3):-

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

nl,attribute(4),

write(" "),

attribute(2),

readchar(_),

removewindow.

/* */

process(4):-

makewindow(2,15,4,"",10,10,10,60),

write(" ALEX.DAT - 1"),nl,

write(" - 2"),nl,

write(">"),

readint(WHAT),

WHAT=1,

retractall(_,alex),

consult("alex.dat",alex),

write(" ..."),nl,

write(" "),

readchar(_),!,removewindow;

WHAT=2,

write(" >"),readln(FNAME),

existfile(FNAME),

retractall(_,alex),

consult(FNAME,alex),

write(" ..."),nl,

write(" "),

readchar(_),!,removewindow;

nl,attribute(4),

write(" !!!"),attribute(7),

readchar(_),

removewindow.

/* */

process(5):-

makewindow(2,15,4,"",10,10,10,60),

write(" ALEX.DAT - 1"),nl,

write(" - 2"),nl,

write(">"),

readint(WHAT),

WHAT=1,

save("alex.dat",alex),

write(" ..."),nl,

write(" "),

readchar(_),!,removewindow;

WHAT=2,

write(" >"),readln(FNAME),

save(FNAME,alex),

write(" ..."),nl,

write(" "),

readchar(_),!,removewindow.

/* */

process(6):-

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

write(" - 1"),nl,

write(" ' ' - 2"),nl,

write(" - 3"),nl,

write(">"),readint(WHAT),

WHAT>0,WHAT<4,

removewindow,

newbase(WHAT).

/* */

process(7):-

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

write(" :"),readln(FIO),

write(" :"),readln(NAME),

write(" :"),readln(OT),

write(" :"),readln(KAF),

write(" :"),readint(NIR),

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

write(" II :"),readint(K2),

write(" III :"),readint(K3),

write(" IV :"),readint(K4),

TOTAL=K1+K2+K3+K4,

OST=NIR-TOTAL,

assertz(alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST)),

removewindow.

/* */

process(1):-

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

alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST),

clearwindow,

write(":",FIO),nl,

write(":",NAME),nl,

write(":",OT),nl,

write(" :",KAF),nl,

write("a :",NIR),nl,

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

write(" II :",K2),nl,

write(" III :",K3),nl,

write(" IV :",K4),nl,

write(" :",TOTAL),nl,

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

attribute(4),

write(" ? (1- 0-) >"),attribute(7),

readint(WHAT),

WHAT=1,

nl,

write(" :"),readln(FIO1),

write(" :"),readln(NAME1),

write(" :"),readln(OT1),

write(" :"),readln(KAF1),

write(" :"),readint(NIR1),

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

write(" II :"),readint(K21),

write(" III :"),readint(K31),

write(" IV :"),readint(K41),

TOTAL1=K11+K21+K31+K41,

OST1=NIR1-TOTAL1,

retract(alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST)),

assertz(alex(FIO1,NAME1,OT1,KAF1,NIR1,K11,K21,K31,K41,TOTAL1,OST1)),

clearwindow;

WHAT=0,removewindow.

/* */

process(8):-

makewindow(2,7,2,"",10,10,3,60),

write(" ? (1- 0-) >"),readint(WHAT),

WHAT=1,exit;

WHAT=0,removewindow.

/* */

newbase(1):-

makewindow(3,7,2," ",10,5,4,67),

retractall(_,alex1),

alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST),

FIO1=FIO,NAME1=NAME,OT1=OT,KAF1=KAF,

NIR1=0,K11=0,K21=0,K31=0,K41=0,TOTAL1=0,OST1=0,

assertz(alex1(FIO1,NAME1,OT1,KAF1,NIR1,K11,K21,K31,K41,TOTAL1,OST1)),

fail.

newbase(1):-

save("alex1.dat",alex1),

write(" . ."),

readchar(_),

viewbase,

removewindow,!.

newbase(2):-

makewindow(3,7,2," ' '",10,5,4,67),

retractall(_,alex1),

alex(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST),

FIO1="",NAME1="",OT1="",KAF1="",

NIR1=NIR,K11=K1,K21=K2,K31=K3,K41=K4,TOTAL1=TOTAL,OST1=OST,

assertz(alex1(FIO1,NAME1,OT1,KAF1,NIR1,K11,K21,K31,K41,TOTAL1,OST1)),

fail.

newbase(2):-

save("alex1.dat",alex1),

write(" . ."),

readchar(_),

viewbase,

removewindow,!.

/* */

viewbase:-

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

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

write(" Π | || | |"),nl,

write("------------|.| |-------------------||"),nl,

write(".||| |Р |I |II |III |IV | |"),nl,

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

alex1(FIO,NAME,OT,KAF,NIR,K1,K2,K3,K4,TOTAL,OST),

cursor(Z,_),

cursor(Z,0),write(FIO),

cursor(Z,8),write(NAME),

cursor(Z,17),write(OT),

cursor(Z,26),write(KAF),

cursor(Z,34),write(NIR),

cursor(Z,43),write(K1),

cursor(Z,48),write(K2),

cursor(Z,53),write(K3),

cursor(Z,58),write(K4),

cursor(Z,63),write(TOTAL),

cursor(Z,69),write(OST),nl,

fail.

viewbase:-

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

nl,attribute(4),

write(" "),attribute(2),

readchar(_),

removewindow.

repeat.

repeat:- repeat.

/* */

@7.

: -

( EXIT)

. , -

, -

( -

).

, -

.

"" .

.

. , , ""

, - , -

,

.

.

@8.

ALEX " ", , .

, , , .

:

0 - pp... -

1 - -

2 - -

3 - -

4 - -

5 - -

6 - -

7 - -

8 - -

, .

.

@ pp...

.

@

.

" ? (1- 0-)". , 1 . 2 . .

@

.

, " ? (1- 0-)".

@

.

. .

@

.

:

ALEX.DAT - 1

- 2

, . ALEX.DAT, 1; , 2. -

.

@

.

- .

@

.

:

- 1

' ' - 2

- 3

. , 1; , , 2. 3.

(. ). .

ALEX1.DAT.

@

.

.

.

@

.

@8.1

"7" . .

@ 8.2

"5" .

@ 8.3

- "6" .

@ 8.4

"4" .

@

.

@

. " "

.,. " "

. " - "

N -1 " - ". .. . -1-95. 1. : - . 2

 

 

 

! , , , .
. , :