is ( n6 ]' @$ O/ w1 T2 G* D Ci :integer; qi : integer & p3 x! ^ D2 v: O& i/ X0 Ldo # q" V O" b. h" J
inspect Ci- Z0 a2 n7 A- K" {) j3 ]
when Ci>0 and Ci <=150 then ; N3 f2 b. B& A" ~" ?6 |9 \3 L3 f print qi=1; ' ~' D9 u) R7 twhen Ci>151 and Ci<=500 then7 O, P: S- @; [4 L% F
print qi=2; " n2 H; ]6 i0 twhen Ci>501 and Ci<=700 then: }) D( Y& u$ h0 y8 m& e, F
print qi=3;3 J7 d, E. G* o5 c v
when Ci>701 and Ci<=1000 then # ?' T) { p) c$ T0 w' \) \1 r print qi=4;$ F* U& i& i3 i0 C ?0 H, c. G$ K
when Ci>1001 and Ci<=2000 then7 h* {0 E1 N7 M' P. J5 b1 K7 n
print qi=5;" q! h8 N6 @: B4 p
when Ci>2000 then0 b: \4 @ m2 s5 E" y: W
print qi=6" Y: g% R5 p' A d9 n' J
end; ) F" A8 [5 l: ^+ Z; rend; * S8 n1 Q/ F1 N$ [; P& S, k( m6 f! {! X 5 F% I' m, G, ]# W. j6 e3 U 运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?/ r n$ W) c. w3 I
谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:- C* |. y3 g$ _3 K
(number : integer) 7 M% v) O* C3 f9 ais0 [$ E0 K. v4 Q, I) ^- h
do* H1 A& i8 R2 \3 D7 E( J8 \
inspect number 4 f8 K' [% {+ {9 I& r1 h when 1 then 4 l% t/ o: a' c$ j/ \
print "not a prime number" v, ^. u5 `% o7 i+ ?% P
when 2,5,7,3 then . O+ T8 t0 t$ W* e
print "prime number" 1 c- _8 d. ?) Z/ a; w5 M6 a) q9 J when 9,4 then / E1 r$ ?# e% G( ?5 ^+ X
print "square number"& u$ T- b; h. @* `
else7 D: Z5 z( S( v6 R/ U% Q" U- F0 k
print "no special number"; q8 a6 x2 _( A6 D7 n
print "or number greater than 9";6 R& p1 E* `* P1 Z I A. B
end; ) |( _9 y. T }+ F0 jend;