Using recursion for this makes for a flexible procedure than can 
easily be used for any length string just by changing the LEN 
constant.
Of course you also have to set up CharList to the range of characters 
you want to use.

const
  CharList = 'abc123';
  LEN = 5;
var
  f: TextFile;
  OutString: array [0..LEN] of char;

procedure CycleCharPosn(ofs: integer);
var
~ i: integer;
begin
~ for i := 1 to Length(CharList) do
~ begin
~~~ OutString[ofs] := CharList[i];
~~~ if ofs < LEN-1 then
// Not final offset -> cycle chars to the right of ofs
~~~~~ CycleCharPosn(ofs+1)
~~~ else
// At end of OutString -> output it
~~~~~ Writeln(f, OutString);
~ end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
~ AssignFile(f, 'outfile.txt');
~ Rewrite(f);
~ OutString[LEN] := #0; // add terminating character
~ CycleCharPosn(0);
~ CloseFile(f);
end;

Tested.
Ian.

--- In [email protected], Arsen Khachatryan <[EMAIL PROTECTED]> 
wrote:
>
> my question is: generate the all possible variant of words and 
symbols, but not clicking every time,just one time click and start to 
generate into the txt file. For example i have program which 
generate  
> 111111
> 111112
> 111113
> ......
> 999999
> now i want to generate like this but with letters and symbols like  
aaaaaa
> aaaaab
> aaaaac
> aaaaa1
> aaaaa2 
> so like this
> 
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to