Здравствуйте, имеется программа тест с базой данных. Скажите пожалуйста, как сделать, чтобы не только шли рандомно вопросы, но и ответы. А также, чтобы выводились баллы не 1 и 0, а в процентном соотношение.
procedure FillArray(var A: array of Integer); var I, S, R: Integer; begin for I := 0 to High(A) do A[I] := I; for i := High(A) downto 0 do begin R := Random(I); S := A[R]; A[R] := A[I]; A[I] := S; end; end;
procedure Ttest.Vopros(nomer:integer); begin DataModule2.Vopros.Locate('Номер',mass[nomer],[]); //варианты ответов DataModule2.Variant.First; RadioButton1.Caption:=DataModule2.Variant.FieldValues['Ответ']; if DataModule2.Variant.FieldValues['Правильный']=true then RadioButton1.Tag:=1 else RadioButton1.Tag:=0;
DataModule2.Variant.Next; RadioButton2.Caption:=DataModule2.Variant.FieldValues['Ответ']; if DataModule2.Variant.FieldValues['Правильный']=true then RadioButton2.Tag:=1 else RadioButton2.Tag:=0;
DataModule2.Variant.Next; RadioButton3.Caption:=DataModule2.Variant.FieldValues['Ответ']; if DataModule2.Variant.FieldValues['Правильный']=true then RadioButton3.Tag:=1 else RadioButton3.Tag:=0;
DataModule2.Variant.Next; RadioButton4.Caption:=DataModule2.Variant.FieldValues['Ответ']; if DataModule2.Variant.FieldValues['Правильный']=true then RadioButton4.Tag:=1 else RadioButton4.Tag:=0; Label2.Caption:=inttostr(strtoint(Label2.Caption)+1); end;
procedure Ttest.Button1Click(Sender: TObject); var i:integer; RB:TRadioButton; cena:string; begin if ((RadioButton1.Checked=true) or (RadioButton2.Checked=true) or (RadioButton3.Checked=true) or (RadioButton4.Checked=true) )
then begin for i := 0 to GroupBox1.ControlCount-1 do begin RB:=TRadioButton(GroupBox1.Controls[i]); if RB.Checked=true then Label1.Caption:=inttostr(strtoint(Label1.Caption)+RB.Tag); end;
if strtoint(Label2.Caption)<16 then begin Vopros(strtoint(Label2.Caption)); RadioButton1.Checked:=false; RadioButton2.Checked:=false; RadioButton3.Checked:=false; RadioButton4.Checked:=false;
test.Caption:='Тестирование.Вопрос'+inttostr(strtoint(Label2.Caption)-1)+' из 15'; end else begin if strtoint(Label1.Caption)>8 then ocen:='5' else if strtoint(Label1.Caption)>6 then ocen:='4' else if strtoint(Label1.Caption)>4 then ocen:='3' else ocen:='2';
end; end else showmessage('Вы не выбрали вариант ответа!'); end;
procedure Ttesti.Button2Click(Sender: TObject); var i,kol:integer; begin For i:=1 to DataModule2.Vopros.RecordCount do begin DataModule2.Vopros.Edit; DataModule2.Vopros.FieldValues['Номер']:=i; DataModule2.Vopros.Post; DataModule2.Vopros.Next; end; DataModule2.Vopros.Last; kol:=DataModule2.Vopros.FieldValues['id'];
Randomize;
SetLength(mass,kol); FillArray(mass);
Vopros(strtoint(Label2.Caption)); testi.Caption:='Тестирование. Вопрос 1 из 50';
Why not settling on games that is fun and at the same time your earning. Well it'll make suspense because the game is well but dude just try it and it gave me hope while pandemic is real rn. DIFFERENT TYPES OF ONLINE SLOT GAMES