is }& s4 M. h: R" b Ci :integer; qi : integer" U. T/ P9 \6 e' T, S* s$ o& e& N! w
do 7 v6 u- G! Y0 m
inspect Ci 7 ?& O# A! p! h2 A8 N! p* \7 u- Ewhen Ci>0 and Ci <=150 then / V; U. @2 L& B* q% ^1 z print qi=1;( l" D. ?, S% D# o$ e
when Ci>151 and Ci<=500 then6 v* U* Y7 x/ h4 d* X
print qi=2; & R: j+ B0 t# V u6 R9 Twhen Ci>501 and Ci<=700 then 3 @1 B' d' L) w8 ~& e) T( p print qi=3;5 f4 a8 A- o, l5 R( g
when Ci>701 and Ci<=1000 then0 }& g+ f6 _5 d( }' T
print qi=4;9 y z& {2 B/ l5 U8 M# C: M
when Ci>1001 and Ci<=2000 then ' V8 o: `/ p1 B. c3 Y print qi=5; , @8 S7 }8 b7 y7 h, v; D$ Awhen Ci>2000 then k3 W& E6 ^9 j/ L$ x9 N! m" I
print qi=60 O5 E( c2 R2 D. i" c
end;# R( X9 ?! S- V' f0 y% O6 N- w+ x, w# A
end;, g& [: Z9 F/ d$ V/ E% Y
" I+ N' | o0 x1 z, X" m 运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?$ ~3 ~6 M/ |* \# }
谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下: * S5 H5 T ?6 D( T& [0 y(number : integer) % G u1 A9 ~0 S) m% L; y: R( Tis. ]7 p5 P. e2 s
do ! \5 J) j+ Z% t r! o- S inspect number : r0 K; ? }; i- w# X0 N when 1 then ; r, h! E! L- b& Y$ M print "not a prime number" % Y& G( h1 e; z" e when 2,5,7,3 then 3 s1 D l- @2 y$ |2 Z
print "prime number"1 E2 Y; U0 z h u
when 9,4 then * a! f2 g1 h! J% C# J' {
print "square number" U/ q0 J; @' E3 _4 H else 7 H+ ]( ]4 A6 [; [" u1 E print "no special number";, Z7 L; _. Z4 u7 X
print "or number greater than 9";: e9 t, V/ Y0 P
end; 8 w4 X; C0 O7 c' Cend;