is 2 k+ H, h! X6 v1 v& R7 p Ci :integer; qi : integer) L% ?; b q. W0 B
do - b5 {$ c7 a; N. H. w7 F: Y/ p
inspect Ci3 \$ q3 |; `( O l( C. E2 G: p
when Ci>0 and Ci <=150 then 9 d9 {( @% L2 ], W8 T! L
print qi=1;7 {+ f2 _$ P1 U. h' o1 ^6 V
when Ci>151 and Ci<=500 then 2 K! M8 H; G W# X5 ~; | print qi=2; 4 S, C" Q8 \8 o9 r- c& K1 e. e0 ywhen Ci>501 and Ci<=700 then 5 e; c5 }. ?/ m, h+ k5 w" N print qi=3;! N8 b0 R- a& b4 m9 q( S, U V R9 _
when Ci>701 and Ci<=1000 then& x$ L. q5 x, I; X# l7 z" U2 r/ } W
print qi=4; $ q9 [ {9 H* B% N, \( G+ o" @when Ci>1001 and Ci<=2000 then8 z' S: {# r+ Y; D6 _+ y
print qi=5;( a% U% b' y2 p2 X4 @$ c
when Ci>2000 then0 y8 G9 S) T6 k
print qi=6 g. f0 S) S* B4 w
end; ( {- \% R2 C q# ^ U1 F! ?% mend; 7 w! f- y4 ?$ L, ^0 D \+ t$ p3 I
运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?+ w R% p0 j s' w7 X. x j
谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下: " ~" s+ {( ?2 l- |) v4 ~(number : integer) . p7 s% \ X. J+ Eis 2 u+ h- U- p3 tdo 4 ~( W0 |$ O, Z0 u4 ?' M inspect number ; X# Y3 ?5 f. m) _8 z1 ~ when 1 then $ t) R. S2 h- n2 P q- Z
print "not a prime number" * t8 f! M+ p4 }) K4 ~5 _/ P when 2,5,7,3 then 3 v: H. U" Z- C, B6 B print "prime number") {# ]4 E1 N$ ?* S+ {/ v- z$ G
when 9,4 then 1 M3 R& u$ ?. \5 r, |/ D print "square number"; v4 @3 k$ @# l
else1 W6 a5 e( Q: G0 g1 K v: k8 t
print "no special number";4 W* A# h8 f9 N% N
print "or number greater than 9";5 U D2 n- t$ g+ M% m o6 | P8 g1 Q
end;0 G7 ^9 d5 l U$ X* ?
end;