Respublikasi oliy va



Download 12,17 Mb.
bet96/113
Sana29.01.2022
Hajmi12,17 Mb.
#415338
1   ...   92   93   94   95   96   97   98   99   ...   113
Bog'liq
ttttttttt

Delphi tilida test dasturini yaratish texnologiyasi
Biz Delphi dasturlash tilida tesdasturini yaratish uchun bizga test dasturi uchun bloknotda sovol tuzib olamiz bunda 1 fanning nomi 2 savollar soni misol uchun 5 ta savol uchun 5 raqam yoziladi 3 vaqt misol uchun 1 minut uchun 1:00 yoziladi savollar ketma-ketligi qatorma-qator yoziladi to’g’ri javobga 1,2,3,4 sonlar qo’yiladi agarda javoblar 4 tadan iborat bo’lsa, savoldan keying 1 qatordagi javob to’g’ri bo’lsa, 1 raqam qo’yiladi va ikkinchi savol boshlanadi va shu ketma-ketlik davom ettiriladi savolning javobini ixtiyoriy qatorga qo’yish mumkin. Rasm 1.
Rasm 1.

Delphida dasturi dizayni quyidagicha berilgan.

Rasm 2.

Fayl bo'limidan testni yuklaymiz rasm 3.


Rasm 3.


Dastur bajarilish dizayni rasm 4.


Rasm 4.


Dasturi kodi quyidagicha unit Unit1;


interface uses


Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Menus, ExtCtrls;
type
// vaqt
TPrTime = Record Min: Byte;
Sec: Byte; end;
TForm1 = class(TForm) MainMenu1: TMainMenu; N11: TMenuItem; Panel1: TPanel; Lbl_Last: TLabel; Lbl_FQuestion: TLabel; BtnV1: TButton;
BtnV2: TButton; BtnV3: TButton; BtnV4: TButton; MQuestion: TMemo; MIAbout: TMenuItem; Timer1: TTimer; MITest: TMenuItem; MITBegin: TMenuItem;
MIOpenFile: TMenuItem; Memo_Temp: TMemo; MV1: TMemo;
MV2: TMemo; MV3: TMemo; MV4: TMemo;
OpenDialog1: TOpenDialog; GBox: TGroupBox;
MIExit: TMenuItem; MITEnd: TMenuItem; LblNameTest: TLabel; Label1: TLabel; Label2: TLabel; PanelButton: TPanel; Label3: TLabel;
Lbl_NomQuestion: TLabel;
procedure FormCreate(Sender: TObject);
function DecTime(Var aa:TPrTime; Sender: TObject): string; procedure PrTimeOut(Sender: TObject);
procedure Timer1Timer(Sender: TObject); procedure MIOpenFileClick(Sender: TObject); procedure MIAboutClick(Sender: TObject); procedure PrFillFileds(Sender: TObject);
procedure MITBeginClick(Sender: TObject); procedure PrClickButton(Sender: TObject); procedure MIExitClick(Sender: TObject); private
{ Private declarations } public
{ Public declarations } end;
var
Form1: TForm1; PrTimeLast: TPrTime; PrTimeFull: TPrTime;
//nomer bo’yicha savol NomQuestion: Byte;
// to’g’ri javoblar bali PrVAnsverOK: Byte;
//nomer savol bo’yicha massiv PrOrderQuestion: array [1..255] of byte; implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject); begin
GBox.Visible:=False; Timer1.Enabled:=False; PrTimeLast.Min:=0; PrTimeLast.Sec:=0; MITBegin.Enabled:=True; MITEnd.Enabled:=False; NomQuestion:=1; Memo_Temp.Lines.Clear; PrVAnsverOK:=0; PanelButton.Visible:=True; end;
// --- Vaqt nazorati ---
Function PrFormatConvert(aa:TPrTime): String; begin
if aa.Min<=9 then result:='0'+IntToStr(aa.Min) else result:=IntToStr(aa.Min);
if aa.Sec<=9 then result:=result+':0'+IntToStr(aa.Sec) else result:=result+':'+IntToStr(aa.Sec);
end;
// Vaqtni o’zgartiriash
function TForm1.DecTime(Var aa:TPrTime; Sender: TObject): string; begin
if aa.Sec=0 then if aa.Min>0 then begin dec(aa.Min); aa.Sec:=59; end
else PrTimeOut(Sender) else dec(aa.Sec);
result:=PrFormatConvert(aa);
end;
// Vaqt bo’yicha savollarga javobni nazorat qilish procedure TForm1.PrTimeOut(Sender: TObject); begin
// Test variantlarini kiritish
if NomQuestion=StrToInt(copy(Memo_Temp.Lines[1],1,pos(' ',Memo_Temp.Lines[1])-1)) then
begin Timer1.Enabled:=False;
PanelButton.Visible:=False; // Tugmachani tanlashni to’xtatish. ShowMessage('Javob (Jami to`g`ri javob):'+#13+#10
+IntToStr(NomQuestion)+'\'+IntToStr(PrVAnsverOK)); //PrStatisticsTest(Sender); Abort;
end;
{v0103} PrTimeLast.Min:=StrToInt(copy(Memo_Temp.Lines[1], pos(' ',Memo_Temp.Lines[1])+1,pos(':',Memo_Temp.Lines[1])-pos(' ',Memo_Temp.Lines[1])-1)); {v0103} PrTimeLast.Sec:=StrToInt(copy(Memo_Temp.Lines[1], pos(':',Memo_Temp.Lines[1])+1,Length(Memo_Temp.Lines[1])- pos(':',Memo_Temp.Lines[1]))); inc(NomQuestion); PrFillFileds(Sender);
end;
procedure TForm1.Timer1Timer(Sender: TObject); begin Lbl_Last.Caption:=DecTime(PrTimeLast,Sender); end;

procedure TForm1.MIOpenFileClick(Sender: TObject); begin


FormCreate(Sender); OpenDialog1.InitialDir:=ExtractFilePath(Application.ExeName); if OpenDialog1.Execute then Memo_Temp.Lines.LoadFromFile(OpenDialog1.FileName); end;
procedure TForm1.MIAboutClick(Sender: TObject); begin
ShowMessage('Administrator: Tami;'+#13+#10+ ' '+#13+#10+
'http:\\www.tami.uz'+#13+#10+#13+#10+ 'e-mail: shoydullo@mail.ru; ');
end;
procedure TForm1.PrFillFileds(Sender: TObject); begin
MQuestion.Clear; MV1.Clear; MV2.Clear; MV3.Clear; MV4.Clear;


MQuestion.Lines[0]:=Memo_Temp.Lines[2+6*(PrOrderQuestion[NomQuestion]-1)]; MV1.Lines[0]:=Memo_Temp.Lines[3+6*(PrOrderQuestion[NomQuestion]-1)]; MV2.Lines[0]:=Memo_Temp.Lines[4+6*(PrOrderQuestion[NomQuestion]-1)]; MV3.Lines[0]:=Memo_Temp.Lines[5+6*(PrOrderQuestion[NomQuestion]-1)];
MV4.Lines[0]:=Memo_Temp.Lines[6+6*(PrOrderQuestion[NomQuestion]-1)]; Lbl_NomQuestion.Caption:=IntToStr(NomQuestion);
if MQuestion.Lines.Count>=3 then MQuestion.scrollbars:=ssVertical else MQuestion.scrollbars:=ssNone;
if MV1.Lines.Count>=3 then MV1.scrollbars:=ssVertical else MV1.scrollbars:=ssNone; if MV2.Lines.Count>=3 then MV2.scrollbars:=ssVertical else MV2.scrollbars:=ssNone; if MV3.Lines.Count>=3 then MV3.scrollbars:=ssVertical else MV3.scrollbars:=ssNone; if MV4.Lines.Count>=3 then MV4.scrollbars:=ssVertical else MV4.scrollbars:=ssNone; end;
procedure TForm1.MITBeginClick(Sender: TObject); Var
Stroka: String; tempNomQuestion, i: byte; begin
// Test faylni yuklash
if Memo_Temp.Lines.Count<4 then begin
ShowMessage('Test faylini yuklang!'); Abort;
end; Stroka:=Memo_Temp.Lines[1];
PrTimeLast.Min:=StrToInt(copy(Stroka,pos(' ',Stroka)+1,pos(':',Stroka)-pos(' ',Stroka)- 1));
PrTimeLast.Sec:=StrToInt(copy(Stroka,pos(':',Stroka)+1,Length(Stroka)- pos(':',Stroka)));
PrTimeFull.Sec:=StrToInt(copy(Stroka,1,pos(' ',Stroka)-1))
*PrTimeLast.Sec mod 60; PrTimeFull.Min:=StrToInt(copy(Stroka,1,pos(' ',Stroka)-1))
*PrTimeLast.Min + StrToInt(copy(Stroka,1,pos(' ',Stroka)-1))
*PrTimeLast.Sec div 60; for i:=1 to 255 do PrOrderQuestion[i]:=0; tempNomQuestion:=0;
while tempNomQuestionbegin randomize;
i:=1+random(StrToInt(copy(Memo_Temp.Lines[1],1,pos(' ',Memo_Temp.Lines[1])-1))); if PrOrderQuestion[i]=0 then
begin inc(tempNomQuestion);
PrOrderQuestion[i]:=tempNomQuestion; end;
end;

PrFillFileds(Sender); LblNameTest.Caption:=Memo_Temp.Lines[0]; Lbl_FQuestion.Caption:=PrFormatConvert(PrTimeFull); Lbl_Last.Caption:=PrFormatConvert(PrTimeLast); NomQuestion:=1;


MITBegin.Enabled:=False; MITEnd.Enabled:=True; GBox.Visible:=True;
PanelButton.Visible:=True; Timer1.Enabled:=True; end;
procedure TForm1.PrClickButton(Sender: TObject); begin
if StrToInt(Memo_Temp.Lines[7+6*(NomQuestion-1)])=(Sender as TButton).Tag Then begin
ShowMessage('To`g`ri'); inc(PrVAnsverOK);
end
else ShowMessage('Noto`g`ri'); PrTimeOut(Sender);
end;
procedure TForm1.MIExitClick(Sender: TObject); begin
Close; end; end.




    1. Download 12,17 Mb.

      Do'stlaringiz bilan baham:
1   ...   92   93   94   95   96   97   98   99   ...   113




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish