Home > Back-end > How to use the most concise method, the output from a to ZZZZ
How to use the most concise method, the output from a to ZZZZ
Time:10-12
In the most concise way output from a b c... Z aa ab, ac... Zz... ZZZZ (length of four as a demo only), please give the code,
CodePudding user response:
The cycle is ok, need others to give the code?
CodePudding user response:
Nested loop
CodePudding user response:
1. According to the length of letters ordering
var I, j, k: Byte; The begin For I:=97 to 122 the do Mmo1. Lines. The Add (Char (I)); For I:=97 to 122 the do For j:=97 to 122 the do The begin Mmo1. Lines. The Add (Char (I) + Char (j)); For k:=97 to 122 the do end; For I:=97 to 122 the do For j:=97 to 122 the do For k:=97 to 122 the do The begin Mmo1. Lines. The Add (Char (I) + Char (j) + Char (k)); end; end;
2. According to the alphabetical order
var I, j, k: Byte; The begin For I:=97 to 122 the do The begin Mmo1. Lines. The Add (Char (I)); For j:=97 to 122 the do The begin Mmo1. Lines. The Add (Char (I) + Char (j)); For k:=97 to 122 the do Mmo1. Lines. The Add (Char (I) + Char (j) + Char (k)); end; end; end;
CodePudding user response:
var I, j: Integer; The begin For I=1 to 4 do//here is you want to output the length of the string The begin For j:=word to word (' a ') (' z ') do The begin Memo1. Lines. The Add (StringOfChar (CRH (j), I)); end; end; end;