is 8 I2 F* z0 P2 i, p Ci :integer; qi : integer1 e1 H+ Y6 ], t+ F; t3 Z
do # C. F% q- z7 ~& Y, q" `, ~( c inspect Ci : _4 T7 l/ N, uwhen Ci>0 and Ci <=150 then & i* `3 m. b% O! n! m print qi=1;2 c- N7 g! _% v. [ h* _
when Ci>151 and Ci<=500 then+ l/ Y$ `! O& h4 L( h$ I3 Y
print qi=2;' L5 ?3 T# Z. ^+ `
when Ci>501 and Ci<=700 then ) k' T1 a. y6 R print qi=3;+ A* _' Q+ ^3 J, p
when Ci>701 and Ci<=1000 then / l5 V1 M8 s7 W print qi=4; 7 z& R3 y5 r8 p8 I+ M2 ^4 h5 Lwhen Ci>1001 and Ci<=2000 then$ d9 A- X* j1 l( i; h0 w4 L
print qi=5;9 Q- q7 g' A( i0 Y. O, z) g1 k: b
when Ci>2000 then $ d3 X7 m5 F2 q3 l print qi=6 , v* ?' S4 V" |5 dend;/ w2 V' s }6 ?" |
end;: Q: w6 f" c! J* n$ l
* S0 n$ j8 c- X/ i& n7 b 运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决? ; n! L! l `, [' }3 t 谢谢!
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下: ) D. K& Z! s( |' P# n(number : integer)/ u, X% i5 w& k% \+ J
is * z+ b4 G W+ x4 ?' X! w8 Fdo1 H& G( R6 H5 n2 D# l& O; e% h% J& x
inspect number( c6 X) R. B2 x- q Y0 |1 D
when 1 then 1 h v+ B' x+ B+ [: v
print "not a prime number"( B" v- e9 {0 t$ B* u1 w. q
when 2,5,7,3 then 2 W P6 X% D2 I* A print "prime number"% S% C; g6 l' H2 ]" G6 F, s4 }
when 9,4 then # j3 t- o5 M( O. y7 Q2 y
print "square number"6 S v j v- ^/ A
else& V& d9 _% K; K) o1 e2 ^: R
print "no special number";$ ?# P! B; N7 v% Q) _$ M
print "or number greater than 9";, d& H" `* X5 e' }! P$ q0 {6 t+ @( h
end; ( `0 X7 H% ]/ o% \end;