Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure ReadQuestion();
- var Ini:TIniFile;
- count, i:integer;
- sect, img:string;
- begin
- Ini:=TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Triggers.cof');
- count:=Ini.ReadInteger('main', 'count', 0);
- if (count > 0) then begin
- i:=Random(count) + 1;
- str(i, sect);
- QuestionText:=Ini.ReadString(sect, 'text', '');
- AnswerText:='1) ' + Ini.ReadString(sect, 'a1', '') + #13 +
- '2) ' + Ini.ReadString(sect, 'a2', '') + #13 +
- '3) ' + Ini.ReadString(sect, 'a3', '') + #13 +
- '4) ' + Ini.ReadString(sect, 'a4', '');
- answer:=Ini.ReadInteger(sect, 'a', 0) and $0F;
- img:=Ini.ReadString(sect, 'img', '');
- Form1.RichEdit1.Text := QuestionText;
- Form1.RichEdit2.Text := AnswerText;
- if (img <> '') then
- Form1.Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'img\\' + img);
- end;
- end;
- {$R *.DFM}
- procedure TForm1.Button1Click(Sender: TObject);
- Var enter:char;
- mark:integer;
- begin
- If (not(form1.RadioButton1.Checked)) and (not(form1.RadioButton2.Checked))and
- (not(form1.RadioButton3.Checked)) and (not(form1.RadioButton4.Checked))
- Then Application.MessageBox('Выберите какой-нибудь ответ.', 'Будьте внимательнее...' ,mb_ok)
- Else
- Begin
- If (form1.RadioButton1.Checked) and (form1.RadioButton1.Tag = answer) Then bal:=bal+1;
- If (form1.RadioButton2.Checked) and (form1.RadioButton2.Tag = answer) Then bal:=bal+1;
- If (form1.RadioButton3.Checked) and (form1.RadioButton3.Tag = answer) Then bal:=bal+1;
- If (form1.RadioButton4.Checked) and (form1.RadioButton4.Tag = answer) Then bal:=bal+1;
- Inc(i);
- if i<=qcount then
- begin
- ReadQuestion();
- end else begin
- mark:=2;
- If bal>=_3 Then mark:=3;
- If bal>=_4 Then mark:=4;
- If bal>=_5 Then mark:=5;
- str(mark,c);
- Form1.RichEdit1.Visible:=False;
- Form1.RichEdit2.Visible:=False;
- Form1.Image1.Visible:=False;
- Form1.Timer1.Enabled:=False;
- Form1.Button1.Visible:=False;
- Form1.GroupBox1.Visible:=False;
- Form1.label1.Visible:=true;
- Form1.label1.Caption:='Ваша оценка '+c + #13 + 'Позовите преподавателя';
- If FileExists('Statist.txt') Then Form1.Memo1.Lines.LoadFromFile('Statist.txt');
- Form1.Memo1.Lines.Text:=Form1.Memo1.Lines.Text+DateToStr(Date)+' '+Form1.Edit1.Text+' '+Form1.Edit2.Text+' '+'Oценка '+c;
- enter:=Chr(23);
- i:=Form1.Memo1.Lines.Add(enter);
- Form1.Memo1.Lines.Move(i,i+1);
- Form1.Memo1.Lines.SaveToFile('Statist.txt');
- i:=1;
- Min:=0;
- Sec:=0;
- Bal:=0;
- end;
- End;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- var Ini:TIniFile;
- begin
- StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+DateToStr(Date);
- Case DayOfWeek(Date) Of
- 1: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Воскресенье';
- 2: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Понедельник';
- 3: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Вторник';
- 4: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Среда';
- 5: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Четверг';
- 6: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Пятница';
- 7: StatusBar1.SimpleText:=StatusBar1.SimpleText+' '+', Суббота';
- End;
- Ini:=TIniFile.Create(ExtractFilePath(Application.ExeName) + 'Triggers.cof');
- _min:=Ini.ReadInteger('main', 'min', 5);
- _sec:=Ini.ReadInteger('main', 'sec', 0);
- Label2.Caption:=IntToStr(_min) + ':' + IntToStr(_sec);
- qcount:=Ini.ReadInteger('main', 'qcount', 5);
- _3:=Ini.ReadInteger('main', '3', 3);
- _4:=Ini.ReadInteger('main', '3', 4);
- _5:=Ini.ReadInteger('main', '3', 5);
- Form1.Edit1.Text:='';
- Form1.Edit2.Text:='';
- Form1.RichEdit1.Text:='';
- Form1.RichEdit1.Text:='';
- randomize;
- i:=1;
- end;
Advertisement
Add Comment
Please, Sign In to add comment