Показать сообщение отдельно
  #3  
Старый 22.11.2010, 23:18
Аватар для deltas
deltas deltas вне форума
Новичок
 
Регистрация: 22.11.2010
Сообщения: 99
Репутация: 47
По умолчанию

Ну вот, специально сел за Дельфи чтоб помочь человеку... так как мне самому уже несколько дней не отвечают
Сильно не пинайте, написано за 5 минут

Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ListBox1: TListBox;
    ListBox2: TListBox;
    ListBox3: TListBox;
    ListBox4: TListBox;
    Label1: TLabel;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
ListBox1.Items.LoadFromFile('test.txt');
ListBox2.Items.LoadFromFile('otvet.txt');
ListBox3.Items.LoadFromFile('rezultat.txt');
end;

procedure TForm1.Button1Click(Sender: TObject);
var t,r,v,d:integer; a:string;
begin
r:=1;d:=1;
for t:=0 to ListBox1.Items.Count-1 do begin
ListBox4.Items.Add('// Начало вопроса: ВопрМножВыбор');
ListBox4.Items.Add(ListBox1.Items.Strings[r]+' {');
a:=Copy(ListBox2.Items.Strings[d],3,1);
label1.Caption:=Label1.Caption+a;
v:=strToInt(a);
if v=1 then begin
ListBox4.Items.Add('='+ListBox1.Items.Strings[r+1]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+2]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+3]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+4]); end;
if v=2 then begin
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+1]);
ListBox4.Items.Add('='+ListBox1.Items.Strings[r+2]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+3]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+4]); end;
if v=3 then begin
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+1]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+2]);
ListBox4.Items.Add('='+ListBox1.Items.Strings[r+3]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+4]); end;
if v=4 then begin
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+1]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+2]);
ListBox4.Items.Add('~'+ListBox1.Items.Strings[r+3]);
ListBox4.Items.Add('='+ListBox1.Items.Strings[r+4]); end;
ListBox4.Items.Add('}');
ListBox4.Items.Add('');
d:=d+1;
r:=r+6;
end;
end;

end.
Ответить с цитированием