is ) s8 }9 J, Y2 W" J- ]) n Ci :integer; qi : integer 5 ?& I! ~$ k+ kdo ! g8 a2 A! R! J0 w3 X8 ` inspect Ci0 U) y0 M, a" C) `* q* W D
when Ci>0 and Ci <=150 then / W- j" N$ O# H) \
print qi=1;. H& j0 J" p' m
when Ci>151 and Ci<=500 then4 w! l1 U0 a3 v6 ]/ d1 b9 k' T7 Q! V
print qi=2; 6 C, i+ v; Z2 P" E* `when Ci>501 and Ci<=700 then 1 T4 m: r" m" K9 B9 v print qi=3;" y# w2 q; s2 H1 L ^/ g
when Ci>701 and Ci<=1000 then , W; F6 I' E$ x print qi=4; 3 |5 T" b' v8 p2 D5 h Owhen Ci>1001 and Ci<=2000 then" D. W( h- @3 F* D$ [ O
print qi=5;1 B8 B6 U* z7 Y; w
when Ci>2000 then 7 K5 x* f; O: ^+ N print qi=6 - V I# {6 g# Xend; 5 n7 A9 h N: O; Q! T, q) Q4 ^8 lend;; B$ r! s- r0 B! Z' v- R2 P S
8 @) T6 o: p/ B 运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?% Y4 l4 r5 c o: `* p# o
谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:- [7 Q9 y7 `4 |3 C/ c6 B3 [
(number : integer) 2 z8 t! c; @8 ~is& M* z" d- I! N& J* F
do1 B3 q: q* g6 Z o: D3 h! }1 H% b
inspect number 6 V$ a5 S w1 x: ~- W when 1 then : a. l% F- Z `4 o; p- C print "not a prime number"" v; t* I4 G( N9 E2 ?
when 2,5,7,3 then 1 o6 n4 {1 y; l" c! Z6 C' l print "prime number"! ~: ?+ V& _5 r+ E9 V
when 9,4 then # R1 U2 \5 x D9 U
print "square number"3 o' V `6 X* h1 D$ w: J$ r1 }
else3 B/ E( Y5 V& O3 }
print "no special number";1 p0 l) H! R4 e6 D- C
print "or number greater than 9"; ) V2 ~# o b& T% M end; & ]* X4 @: o; l: q7 n1 h! Rend;