Смекни!
smekni.com

Создание программного обеспечения электронного учебника (стр. 8 из 8)

begin

Rows[i+1].Strings[3+j]:=FloatToStr(Stud[i].Tests[j])+'/'+FloatToStr(Stud[i].Exams[j]);

end;

end;

end;

end;

Листинг 7.

procedure LoadQues;

var

i,n,j,l: integer;

ns: string;

begin

for i:=1 to PCNT do

begin

AssignFile(QuesFile,'Book\'+IntToStr(i)+'.txt');

Reset(QuesFile);

ReadLn(QuesFile,ns);

n:=StrToInt(ns);

QuesCnt[i]:=n;

for j:=1 to n do

begin

if Eof(QuesFile)=false then ReadLn(QuesFile,ns)

else Application.MessageBox('Конецфайла','Экзаменатор',mb_IconExclamation+mb_Ok);

Questions[i,j].Text:=TrimLeft(MidStr(ns,4,255));

for l:=1 to 4 do

begin

if Eof(QuesFile)=false then ReadLn(QuesFile,ns)

else Application.MessageBox('Конецфайла','Экзаменатор',mb_IconExclamation+mb_Ok);

if RightStr(ns,1)='*' then

begin

Questions[i,j].Answers[l].Text:=TrimLeft(MidStr(ns,2,Length(TrimRight(ns))-2));

Questions[i,j].Answers[l].Rt:=true;

end

else

begin

Questions[i,j].Answers[l].Text:=TrimLeft(MidStr(ns,2,Length(TrimRight(ns))));

Questions[i,j].Answers[l].Rt:=false;

end;

end;

end;

CloseFile(QuesFile);

end;

end;

Листинг 8.

procedure Decrypt;

begin

WEAW('unrar.exe x -ptachikoma -o+ book.dat');

while not((FileExists('book\1.txt'))

and(FileExists('book\2.txt'))

and(FileExists('book\3.txt'))

and(FileExists('book\4.txt'))

and(FileExists('book\5.txt')))

do Sleep(100);

end;

//------------------------------------------------------------------------------------

procedure Crypt;

begin

DeleteFile('book\1.txt');

DeleteFile('book\2.txt');

DeleteFile('book\3.txt');

DeleteFile('book\4.txt');

DeleteFile('book\5.txt');

end