Ver Mensaje Individual
  #13  
Antiguo 22-10-2016
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Basándome en la imágen que pusiste, fijate si este ejemplo es similar a lo que buscas.
Código Delphi [-]
...
procedure combinatoria(v: array of Integer; Serie: TStrings);
var
  a,b,c,d,e,f: Integer;
begin
  if Length(v) <> 6 then
    raise Exception.Create('Error: Deben ser 6 elementos');
  for a := Low(v) to High(v) do
    for b := Low(v) to High(v) do
      for c := Low(v) to High(v) do
        for d := Low(v) to High(v) do
         for e := Low(v) to High(v) do
           for f := Low(v) to High(v) do
              if not(
  (v[a]=v[b])or(v[a]=v[c])or(v[a]=v[d])or(v[a]=v[e])or(v[a]=v[f])or
  (v[b]=v[c])or(v[b]=v[d])or(v[b]=v[e])or(v[b]=v[f])or
  (v[c]=v[d])or(v[c]=v[e])or(v[c]=v[f])or
  (v[d]=v[e])or(v[d]=v[f])or
  (v[e]=v[f])) then
    Serie.Add(Format('%d %d %d %d %d %d',[v[a], v[b], v[c], v[d], v[e], v[f]]));
end;


procedure TForm1.FormCreate( Sender: TObject );
var
  i: Integer;
  lv: TListView;
begin
  lv := ListView1;
  lv.GridLines := True;
  for i := 1 to 7 do lv.Columns.Add;
  lv.Columns[0].Caption := 'FILA';
  lv.Columns[1].Caption := 'COL. 1';
  lv.Columns[2].Caption := 'COL. 2';
  lv.Columns[3].Caption := 'COL. 3';
  lv.Columns[4].Caption := 'COL. 4';
  lv.Columns[5].Caption := 'COL. 5';
  lv.Columns[6].Caption := 'COL. 6';
end;


procedure TForm1.btnLoadClick( Sender: TObject );
var
  lv: TListView;
  li: TListItem;
  Series, aux: TStrings;
  i : Integer;
  vn : array[0..5] of Integer;
begin
  // Podes poner tus valores en un arreglo
  vn[0] := 15; vn[1]:= 17; vn[2]:= 41; vn[3]:= 43; vn[4]:= 5; vn[5]:= 37;
  // y enviarlo como argumento: combinatoria( v, Series);

  // o enviar los valores directamente: combinatoria( [15, 17, 41, 43, 5, 37], Series);

  lv := ListView1;
  Series := TStringList.Create;
  lv.Items.BeginUpdate;
  try
    combinatoria(vn, Series );
    for i := 0 to Series.Count - 1 do
    begin
      aux := TStringList.Create;
      try
        ExtractStrings( [' '], [], PChar(Series[i] ), aux );
        li := lv.Items.Add;
        li.Caption := IntToStr(i + 1);
        li.SubItems.AddStrings( aux );
      finally
        aux.Free;
      end;
    end;
  finally
    Series.Free;
    lv.Items.EndUpdate;
  end;
end;


Salida:


Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita