diff --git a/PRAKTIKA.PAS b/PRAKTIKA.PAS index 981d7d2..f278184 100644 --- a/PRAKTIKA.PAS +++ b/PRAKTIKA.PAS @@ -1,18 +1,21 @@ program pr; - uses crt, graph; + uses crt, graph, dos; var tmp_d, tmp_m : integer; {screen variables} p,p1 : char; {readkey} y_wlcm : integer; {Vsplivayushii text} - i,e : integer; {Vspomogatelnie peremennye} + i,e,nlect : integer; {Vspomogatelnie peremennye} cur : integer; {Posicia kursora v menu} - x,y, th : integer; {Peremennye dlya vyvoda teksta} + x,y, hgt : integer; {Peremennye dlya vyvoda teksta} ch, cf, ct : integer; {Peremennye dlya chtenia teksta} nolect : integer; {Nomer lekcii} numtest, otv : integer; {Test} f : text; {File lekcii} + th,tm,ts,tms : word; {Время} + t1,t2, tminim : longint; {Время} javame, author, welcome, dtpa, s, menustatus, tmp, + teststatus, lectstatus,path,j: string; mainmenu : array [1..22] of string; {menu} lines : array [1..30] of string; {readtext} @@ -35,6 +38,7 @@ program pr; procedure lections(var lect:integer); forward; procedure ui(ttitle, tbar : string; back : integer); forward; procedure question(var tst:integer); forward; + procedure marks(var pr_otv: integer); forward; {Procedura inicializacii peremennyh} procedure init_variables; @@ -42,7 +46,7 @@ program pr; cf := 9; ct := 14; x := 20; - th := 400; {Vysota svobodnoy oblasti pri vyvode teksta} + hgt := 400; {Vysota svobodnoy oblasti pri vyvode teksta} y_wlcm := -20; cur := 1; author := 'Автор: Виктор aNNiMON Мельник'; @@ -50,6 +54,7 @@ program pr; welcome := 'Приветствую'; javame := 'JavaME'; lectstatus := 'F1 - Помощь T - Тест ESC - Меню'; + teststatus := 'F1 - Помощь L - Лекции ESC - Меню'; menustatus := 'ESC - Выход UP,DOWN,LEFT,RIGHT - Передвижение курсора ENTER - Переход'; path := {'Y:\SCHOOL.PAK\2PO-07\'}'C:\BP\BIN\annimon\' {'D:\TP\BIN\annimon\'}; {Menu Lekcii} @@ -139,7 +144,7 @@ program pr; bar(0, 0, 640, 18); setcolor(13); settextstyle(2,0,6); - outtextxy(300, 0, ttitle); + outtextxy(320-TextWidth(title) div 2, 0, ttitle); {Status} setfillstyle(1, 7); settextstyle(2,0,4); @@ -158,7 +163,7 @@ program pr; repeat readln(f, lines[numl]); inc(numl); - until eof(f) or (numl>(th div ch)) or (numl>30); + until eof(f) or (numl>(hgt div ch)) or (numl>30); {Ostalnie zapolnyayem probelami} for i:= numl to 30 do lines[i] := ''; end; @@ -172,7 +177,7 @@ program pr; if not eof(f) then begin repeat - readln(f, test[numl]); + readln(f, test[numl]); inc(numl); until eof(f) or (numl>5); end; @@ -232,41 +237,70 @@ program pr; {Procedura testirovania} procedure question(var tst:integer); + var fff: boolean; + nt: integer; {num of questions} begin init_screen; nolect := tst div 2; str(nolect, tmp); assign(f, path+'test'+tmp+'.txt'); reset(f); + readln(f, nt); ch := TextHeight(tmp)+20; p1:= '0'; otv:=0; {Kol-vo pravilnyh otvetov} - for i:=1 to 10 do + gettime (th,tm,ts,tms); + t1:=tms+ts*60+tm*3600+th*3600*60; + for i:=1 to nt do begin readtlines; repeat {Obrabotka klavish upravlenia} - if p1='b' then changebk {color background} - else if p1='n' then changetxt {n - text color} - else if (p1='1') or (p1='2') or (p1='3') then {1,2,3} - begin - if(p1=test[5]) then inc(otv); - end; - ui(tmp,lectstatus,cf); + ui('Тест #'+tmp+' Вопрос '+i,teststatus,cf); {Otrisovka teksta} setcolor(ct); settextstyle(2,0,5); for e:=1 to 4 do outtextxy(x,20+e*ch,test[e]); + fff:=false; p1:=readkey; - until (p1=#27) or (p1='l') or (p1=#59); - if(p1='l') then begin break; lections(tst); end; {L - Lecton} - if(p1=#59) then begin break; help_screen; end; {F1 - Help} - end; - {End of test} - + if p1='b' then changebk {color background} + else if p1='n' then changetxt {n - text color} + else if (p1='1') or (p1='2') or (p1='3') then {1,2,3} + begin + if(p1=test[5]) then inc(otv); + fff:=true; + end; + until fff or (p1=#27) or (p1='l') or (p1=#59); + if(p1=#27) then break + else if(p1='l') then lections(tst) {L - Lection} + else if(p1=#59) then help_screen; {F1 - Help} + end; + {End of test} + gettime (th,tm,ts,tms); + t2:=tms+ts*60+tm*3600+th*3600*60; + if(i=nt) then marks(otv, nt); + end; + {Procedura vyvoda ocenok} + procedure marks(var pr_otv, num_otv: integer); + var out: string; + mrk: integer; + begin + ui('Оценка','',cf); + settextstyle(3,0,6); + setcolor(ct); + mrk := pr_otv * 100 div num_otv; + if(mrk<25) then out:='Неудовлетворительно' + else if(mrk<50) then out:='Удовлетворительно' + else if(mrk<75) then out:='Хорофо =)' + else out:='Браво. Няяяяк ^_^'; + outtextxy(67,320-TextWidth(out) div 2,out); + repeat p:=readkey + until (p=#27); + end; + {Procedura obrabotki vibrannogo punkta menu} procedure choicemenu(var cur:integer); begin @@ -321,4 +355,4 @@ program pr; helloscreen; menu; closegraph; - end. \ No newline at end of file + end.