is+ c/ X- _; |9 y# ?, Y3 ?
Ci :integer; qi : integer 8 k9 r/ I1 U2 n' C i9 d. i" Ddo 3 S# W& I, N, O1 L inspect Ci 6 ?; a+ W" C* S, k8 a6 Gwhen Ci>0 and Ci <=150 then 0 w% N1 z* a9 N+ n( `
print qi=1; ; |' Y* r% K$ g0 \% Rwhen Ci>151 and Ci<=500 then" ?1 n. A8 G7 S! S
print qi=2;& e' K6 R' d7 s A* z
when Ci>501 and Ci<=700 then5 X4 ?" A0 X0 q8 E
print qi=3; 2 U6 M0 R# r9 K4 y9 X" ]) I" uwhen Ci>701 and Ci<=1000 then% g- }. v8 d: }1 y8 X9 U- r" X
print qi=4;% z* H) I7 ?/ Z7 {% d) o
when Ci>1001 and Ci<=2000 then }7 w s, R1 c" h9 r& x A
print qi=5;) S6 x: z/ j, A r0 p
when Ci>2000 then5 F3 R8 e, V c7 b8 V
print qi=6) R! Y7 v7 D6 \
end;( u6 P0 k& P7 q, y
end;, i) G; [& D/ n0 ?& p7 T% f
8 r+ y5 C" b, f. [/ r) s 运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?* }; p ?- B# J; Z
谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:. m" k. I, n- N ~6 h4 N
(number : integer): e7 p L) }/ w; a: d
is- } T2 O; ^. ] I. Y- M
do/ x7 S. A8 _2 i' g
inspect number& x# y8 _8 S& [$ M* R" p7 R
when 1 then " j& U% C9 v6 y; B print "not a prime number" 0 W: ^6 M N3 a# |0 c when 2,5,7,3 then & Q" O3 A6 A" k6 ^" \# g print "prime number"+ V! E% T. V! r4 T4 @
when 9,4 then 1 t! X' k4 y* v E$ ~
print "square number" & ]8 H1 N2 d) t, ]5 n; w; s else 3 C C( _ v2 y4 Q1 m( w. w, | print "no special number"; 1 q: G0 B' x& [" ~2 e print "or number greater than 9";# E% P* p, S6 G8 Z7 T. S5 l1 k' L
end; # [$ N' i# ^$ a5 P3 o( Tend;