pascal怎么使用for语句(高手进来一下)(200分)

  • 主题发起人 主题发起人 yunxi126
  • 开始时间 开始时间
Y

yunxi126

Unregistered / Unconfirmed
GUEST, unregistred user!
我要打印
1111111
1111112
1111113
1111114
1111121
1111122
1111123
1111124
1111131
.
.
.
4444443
4444444

一共65535个数显在memo1.text中
 
var
I: Integer;
begin
for I := 1111111 to 4444444 do
Memo1.Lines.Add(IntToStr(I));
end;
 
不是。。
这个大哥理解错了。
 
就是有点像
0到65535的十进制转成


"4"进制
 
分少可以再加
 
var
i,j integer;
i:=1111111;
while i<4444444 do
begin
for i:=1 to 4 do
begin
memo.add(IntTostr(j))
j:=j+1;
end;
j:=j+6;
end;
 
var
a:integer;
begin
for a := 1111111 to 4444444 do
begin
if (pos('5',inttostr(a))>0)or
(pos('6',inttostr(a))>0)or
(pos('7',inttostr(a))>0)or
(pos('8',inttostr(a))>0)or
(pos('9',inttostr(a))>0)or
(pos('0',inttostr(a))>0) then
begin
continue;
end;
Memo1.Lines.Add(IntToStr(a));
end;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c,d,e,f,g : byte ;
begin
for a:=1 to 4 do
for b:=1 to 4 do
for c:=1 to 4 do
for d:=1 to 4 do
for e:=1 to 4 do
for f:=1 to 4 do
for g:=1 to 4 do
memo1.Lines.Add(inttostr(a*1000000+b*100000+c*10000+d*1000+e*100+f*10+g)) ;
end;
 
var
a,b,c:integer;
AStringList:TStringList;
begin //使用TStringList速度更快
AStringList:=TStringList.Create;
for a := 1111111 to 4444444 do
begin//过滤掉5,6,7,8,9,0等数字
if (pos('5',inttostr(a))>0)or
(pos('6',inttostr(a))>0)or
(pos('7',inttostr(a))>0)or
(pos('8',inttostr(a))>0)or
(pos('9',inttostr(a))>0)or
(pos('0',inttostr(a))>0) then
begin
continue;
end;
AStringList.Add(IntToStr(a));
end;
Memo1.Lines:=AStringList;
AStringList.Free;
end;
 
沙发,听课帮顶
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
I
回复
0
查看
810
import
I
后退
顶部