var
I1,I2,I3,I4,I5,I6,I7,I8: Integer;
a:Array[1..4] Of PChar;// = '+-*/'; //('+','-','*','/');
s1:string;
begin
mmo1.Lines.Clear;
a[1]:='+';
a[2]:='-';
a[3]:='*';
a[4]:='/';
for I1 := 1 to 4 do
for I2 := 1 to 4 do
for I3 := 1 to 4 do
for I4 := 1 to 4 do
for I5 := 1 to 4 do
for I6 := 1 to 4 do
for I7 := 1 to 4 do
for I8 := 1 to 4 do begin
s1:='1'+a[I1]+'2'+a[I2]+'3'+a[I3]+'4'+a[I4]+'5'+a[I5]+'6'+a[I6]+'7'+a[I7]+'8'+a[I8]+'9';
bcParser1.expression:=s1;
if bcParser1.Value=100 then
mmo1.lines.add(s1+'=100');
end;
end;
I1,I2,I3,I4,I5,I6,I7,I8: Integer;
a:Array[1..4] Of PChar;// = '+-*/'; //('+','-','*','/');
s1:string;
begin
mmo1.Lines.Clear;
a[1]:='+';
a[2]:='-';
a[3]:='*';
a[4]:='/';
for I1 := 1 to 4 do
for I2 := 1 to 4 do
for I3 := 1 to 4 do
for I4 := 1 to 4 do
for I5 := 1 to 4 do
for I6 := 1 to 4 do
for I7 := 1 to 4 do
for I8 := 1 to 4 do begin
s1:='1'+a[I1]+'2'+a[I2]+'3'+a[I3]+'4'+a[I4]+'5'+a[I5]+'6'+a[I6]+'7'+a[I7]+'8'+a[I8]+'9';
bcParser1.expression:=s1;
if bcParser1.Value=100 then
mmo1.lines.add(s1+'=100');
end;
end;
解决方案 »
- 散分混眼熟
- 请问如何将String类型转换成TByteDynArray类型?
- 请教高手,有众多错误,。。。。
- 有東莞城區附近的D程序員嗎?
- 请问这个参数是什么意思,idudpclient.SendBuffer
- 请教一个API的具体用法 URLOpenBlockingStream
- dbgrid显示access数据库中的单精度类型的数据问题。
- Delphi VCL 完整类树,For D5,D6,D7,快来下载!!!
- 哪里可以得到vcl面板上servers標簽下的使用說明﹐比如outlook的?
- 请问谁有串口通讯的例程!
- 请教字符串的分析---------路过的兄弟帮看看
- 关于数组去掉重复-----------为什么执行2次才次没有重复?
a: Array [1 .. 4] Of PChar = ('+', '-', '*', '/');
a: Array [1 .. 4] Of PChar = ('+', '-', '*', '/');
就无法在程序运行中再改变数组的 内容如果 var
a: Array [1 .. 4] Of PChar = ('+', '-', '*', '/');
就会报楼上的错误有没有两全其美的办法,谢谢
procedure TForm1.Button1Click(Sender: TObject);
var
I,II,I1,I2,I3,I4,I5,I6,I7,I8: Integer;
a:Array[1..4] Of PChar;
B:Array [1..9] of Double;
s1:string;begin
memo1.Lines.Clear;
a[1]:='+';
a[2]:='-';
a[3]:='*';
a[4]:='/';
for I8 := 1 to 4 do
for I7 := 1 to 4 do
for I6 := 1 to 4 do
for I5 := 1 to 4 do
for I4 := 1 to 4 do
for I3 := 1 to 4 do
for I2 := 1 to 4 do
for I1 := 1 to 4 do
begin
B[1]:=1;
B[2]:=2;
B[3]:=3;
B[4]:=4;
B[5]:=5;
B[6]:=6;
B[7]:=7;
B[8]:=8;
B[9]:=9;
if B[9]<>0 then
if i8=4 then begin
B[8]:= B[8]/B[9];
B[9]:=0;
end;
if i8=3 then begin
B[8]:= B[8]*B[9];
B[9]:=0;
end;
if B[8]<>0 then
if i7=4 then begin
B[7]:= B[7]/B[8];
B[8]:=0;
end;
if i7=3 then begin
B[7]:= B[7]*B[8];
B[8]:=0;
end;
if B[7]<>0 then
if i6=4 then begin
B[6]:= B[6]/B[7];
B[7]:=0;
end;
if i6=3 then begin
B[6]:= B[6]*B[7];
B[7]:=0;
end;
if B[6]<>0 then
if i5=4 then begin
B[5]:= B[5]/B[6];
B[6]:=0;
end;
if i5=3 then begin
B[5]:= B[5]*B[6];
B[6]:=0;
end;
if B[5]<>0 then
if i4=4 then begin
B[4]:= B[4]/B[5];
B[5]:=0;
end;
if i4=3 then begin
B[4]:= B[4]*B[5];
B[5]:=0;
end;
if B[4]<>0 then
if i3=4 then begin
B[3]:= B[3]/B[4];
B[4]:=0;
end;
if i3=3 then begin
B[3]:= B[3]*B[4];
B[4]:=0;
end;
if B[3]<>0 then
if i2=4 then begin
B[2]:= B[2]/B[3];
B[3]:=0;
end;
if i2=3 then begin
B[2]:= B[2]*B[3];
B[3]:=0;
end;
if B[2]<>0 then
if i1=4 then begin
B[1]:= B[1]/B[2];
B[2]:=0;
end;
if i1=3 then begin
B[1]:= B[1]*B[2];
B[2]:=0;
end;
if i8=2 then begin
B[8]:= B[8]-B[9];
B[9]:=0;
end;
if i8=1 then begin
B[8]:= B[8]+B[9];
B[9]:=0;
end;
if i7=2 then begin
B[7]:= B[7]-B[8];
B[8]:=0;
end;
if i7=1 then begin
B[7]:= B[7]+B[8];
B[8]:=0;
end;
if i6=2 then begin
B[6]:= B[6]-B[7];
B[7]:=0;
end;
if i6=1 then begin
B[6]:= B[6]+B[7];
B[7]:=0;
end;
if i5=2 then begin
B[5]:= B[5]-B[6];
B[6]:=0;
end;
if i5=1 then begin
B[5]:= B[5]+B[6];
B[6]:=0;
end;
if i4=2 then begin
B[4]:= B[4]-B[5];
B[5]:=0;
end;
if i4=1 then begin
B[4]:= B[4]+B[5];
B[5]:=0;
end;
if i3=2 then begin
B[3]:= B[3]-B[4];
B[4]:=0;
end;
if i3=1 then begin
B[3]:= B[3]+B[4];
B[4]:=0;
end;
if i2=2 then begin
B[2]:= B[2]-B[3];
B[3]:=0;
end;
if i2=1 then begin
B[2]:= B[2]+B[3];
B[3]:=0;
end;
if i1=2 then begin
B[1]:= B[1]-B[2];
B[2]:=0;
end;
if i1=1 then begin
B[1]:= B[1]+B[2];
B[2]:=0;
end;
B[1]:=B[1]+B[2]+B[3]+B[4]+B[5]+B[6]+B[7]+B[8]+B[9];
s1:='1'+a[I1]+'2'+a[I2]+'3'+a[I3]+'4'+a[I4]+'5'+a[I5]+'6'+a[I6]+'7'+a[I7]+'8'+a[I8]+'9';
if (B[1]>99.9999) and (B[1]<100.0001) then
begin
memo1.lines.add(s1+'=100');
end;
end;
end;
begin a:='+-*/';请指教