请问以下代码如何编写:
当FX上穿R1时,PP=R1,CYKG=1;
当FX上穿S1时,PP=S1,CYKG=1;
当FX下穿S1时,PP=S1,CYKG=-1;
当FX下穿R1时,PP=R1,CYKG=-1;
其中:R1>S1
if cross(fx,r1) then begin
pp:=r1;
cykg:=1;
end
if cross(fx,s1) then begin
pp:=s1;
cykg:=1;
end
if cross(s1,fx) then begin
pp:=s1;
cykg:=-1;
end
if cross(r1,fx) then begin
pp:=r1;
cykg:=-1;
end
编译时报错,说CROSS不能放在条件语句中.
比如
if cross then begin
.........
end
是可以的
但是
if ....... then begin
if cross then begin
....
end
end
是不行的
明白,谢了