is + B: X p% ^% w$ t Ci :integer; qi : integer: m5 {4 N/ Q. N. w! m
do 4 z& o) k( v( J2 V inspect Ci& y- C+ h4 Y- c0 t: @ b' N3 `' h
when Ci>0 and Ci <=150 then " h- u4 v: K- j2 y print qi=1;" t. `4 n$ n5 D( V( i$ ?, K, T3 R
when Ci>151 and Ci<=500 then" A4 X9 t7 Q, ^ C, F
print qi=2;7 E& S( h( u6 ~4 Z
when Ci>501 and Ci<=700 then7 K& r& f4 P" e: l
print qi=3; . V" m5 s/ \2 s* V* |& Kwhen Ci>701 and Ci<=1000 then " ]+ K4 p, D) d7 C1 G. f; Y print qi=4;6 `2 n5 }0 T6 r: E' R: C8 u: S
when Ci>1001 and Ci<=2000 then 7 l1 i: A* W6 B2 V& d4 ^1 b print qi=5;- g% \8 ^9 d _, @
when Ci>2000 then : i+ s1 v9 @: {4 j1 X print qi=6 ' \+ j+ ^+ z F1 ^% w; ?end;$ r5 `+ r9 V& @# Z8 x
end;; G( y3 c" [$ ~# }* X9 a/ w# d
/ A# z( {" C, e9 U+ d+ ^1 W- d7 n
运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决? ( M* Q+ K1 Q8 V6 E2 _/ } 谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下: 9 n2 q* B5 O/ g(number : integer) : k. [3 P: k# s( R6 f! N3 Q1 F Pis0 P7 h \) w8 {; E3 C( V. T; V
do }, `4 F6 M. j" l: q+ l inspect number: H0 a5 |. g0 T
when 1 then / _! ]2 R E7 o6 b7 Z* z9 E. w
print "not a prime number"9 e }- }) ~6 h1 z9 N; S6 T
when 2,5,7,3 then " q3 m8 E& T3 Q5 `6 c8 z/ B7 i print "prime number"8 z( i0 ?! r! w9 A& t3 \
when 9,4 then 6 z' @; ?8 F6 k, K
print "square number"% A( j) y$ y0 J: m" C
else 3 k; N3 f, K3 A6 [6 }9 ^ print "no special number";2 d% `; r6 o# ~3 x
print "or number greater than 9";& n! j+ S* T8 X/ k
end; % D/ y6 f5 M# ^2 L3 ]3 h4 m+ ~end;