因为你a的赋值没有变,所以没必要嵌套的这么麻烦:
if a=0 then button1.click;
if (a>0) and (a<10)then
begin
b:=1;
c:=0;
end else
c:=1;
if (a<0) or (a>=10)then button2.click;
begin
if a=0 then
begin
button1.click
end
else if a>0 and a<10 then
begin
b:=1;
if b>=0 then
c:=0
else
c:=1;
end
else
button2.click;
end;
这样写的,不过
b:=1;
if b>=0 then
c:=0
else
c:=1;
这儿有问题,c永远为0
你这个题有问题啊,如果B=1的话,那C永远都是0,得不到其他答案啊。
if (a=0) then
begin
button1.click();
end
else if (a>0) then
begin
b:=1;
if (b>=0) then c:=0 else c:=1;
end
else
begin
button2.click();
end;
感觉象下边的结果
begin
if a=0 then button1.click
else if (a>0)and(a<10)then begin
b:=1;
c:=0;
end else button2.click;
end;