stud("Ivanova K.R.","inf",5).
stud("Petrov E.A.","inf",2).
stud("Rogov J.A..","inf",4).
stud("Tashirin L.M.","inf",2).
stud("Galin A.V.","inf",2).
do_dbd:-stud(F,D,B),assertz(dstud(F,D,B)),fail.
do_dbd:-!.
do:-makewindow(1,9,1,"DBD",2,10,20,60),
menu,clear_dbd,removewindow.
menu:-repeat,clearwindow,nl,
write("1. Clear BD"),nl,
write("2. Create BD"),nl,
write("3. Load BD"),nl,
write("4. View BD"),nl,
write("5. Nesdavshie"),nl,
write("6. Add to BD"),nl,
write("7. Delete from BD"),nl,
write("8. Save BD"),nl,
write("9. Exit "),nl,
write("You choise (1-9): "),
readint(K),process(K),K=9,!.
process(1):-clear_dbd,write("BD clear!"),readchar(_).
process(2):-do_dbd,write("BD greate!"),readchar(_).
process(3):-makewindow(7,7,1,"Load BD",5,10,10,30),
consult("DBD.txt"),!,write("BD loaded!"),
readchar(_),removewindow.
process(4):-makewindow(7,7,1,"View BD",2,10,20,50),nl,
print,nl,write("Press any key"),readchar(_),
removewindow.
process(5):-makewindow(7,7,1,"Student",5,5,20,50),nl,
spisok(L),output(L),nl,
write("Nagmite klavishy"),readchar(_),
removewindow.
process(6):-makewindow(8,7,1,"Add to BD",5,5,15,40),nl,
write("F.I.O.: "),readln(F),
write("Predmet: "),readln(D),
write("Ocenka: "),readint(B),!,
assertz(dstud(F,D,B)),write("Student ",F," was added to BD"),
readchar(_),removewindow.
process(7):-makewindow(8,7,1,"Delete",5,5,15,40),nl,
write("F.I.O.: "),readln(F),
write("Predmet: "),readln(D),
write("Ocenka: "),readint(B),!,
delete(F,D,B),removewindow.
process(8):-save("DBD.txt"),write("BD save!"),readln(_).
process(9):-!.
print:-dstud(F,D,B),write(F," ",D," ",B),nl,fail.
print:-!.
delete(F,D,B):-retract(dstud(F,D,B)),!,write(F," udalena"),readchar(_).
spisok(L6):-findall(X,dstud(X,"mat",2),L11),
findall(X,dstud(X,"mat",1),L12),
soed2(L11,L12,L1),
findall(X,dstud(X,"fiz",2),L21),
findall(X,dstud(X,"fiz",1),L22),
soed2(L21,L22, L2),
findall(X,dstud(X,"him",2),L31),