
18.06.2010, 20:20
|
 |
Прохожий
|
|
Регистрация: 19.05.2010
Сообщения: 30
Репутация: 10
|
|
тестовая программа
помогите пожалуйста доделать код тестовой программы
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
const
kol_vop=10;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
Edit1: TEdit;
Edit2: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
verno:boolean;
Questions:array [1..kol_vop] of string;
right,wrong:integer;
endl:byte;
i:integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=1;
right:=0;
wrong:=0;
//Здесь сам заполняешь вопросы которые тебе нужны и соответственно напиши там варианты ответов А, B, C и D
Questions[1]:='Для чего нужен Делфи?';
Questions[2]:='Структура делфи -';
Questions[3]:='';
Questions[4]:='';
Questions[5]:='';
Questions[6]:='';
Questions[7]:='';
Questions[8]:='';
Questions[9]:='';
Questions[10]:='';
Memo1.Text:=Questions[1];
end;
procedure TForm1.Button1Click(Sender: TObject);
Var j:integer;
begin
If i=kol_vop+1 then
begin
showmessage('Тест окончен');
exit;
end;
//первый вопрос
If i=1 then
//здесь вписывай нужный тебе радиобаттон, который отвечает за правильный вариант вопроса
If RadioButton1.Checked=true then begin // как написать варианты ответов для радиобаттонов
//в этом случае, чтобы обновлялись со следующим вопросом ????? помогите дописать пожалуйста
inc(right);
inc(wrong);
end;
//второй вопрос
If i=2 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=3 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=4 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=5 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=6 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=7 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=8 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=9 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
If i=10 then
If RadioButton2.Checked=true then begin
inc(right);
inc(wrong);
end;
Edit1.Text:='Правильных ответов '+inttostr(right);
Edit2.Text:='Не правильных ответов '+inttostr(wrong);
inc(i);
If i=kol_vop+1 then
exit;
Memo1.Text:=Questions[i];
end;
end.
|