设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8078|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is9 ~0 p; D; D$ }0 z
       Ci :integer; qi : integer' R  K  @$ R! }( [, E% Q; V. r
do $ ]" A4 R) e3 y* p
       inspect Ci+ A' T: n( }! A5 @
when Ci>0 and Ci <=150 then # d$ J& {' A6 Y: V# r) Z
       print qi=1;1 x0 c+ q4 Z$ e3 l
when Ci>151 and Ci<=500 then/ X$ m0 [" t4 a1 V1 \
       print qi=2;
) Q. F" P# W3 D7 N( Rwhen Ci>501 and Ci<=700 then. a. B4 z7 ~& h( {7 W6 t) l6 p. C
       print qi=3;3 M% L3 q6 b0 b* @3 N0 _) e' j
when Ci>701 and Ci<=1000 then6 b/ }: Y/ i) \7 q' |+ B3 b
       print qi=4;
* w8 r, G" ^5 [when Ci>1001 and Ci<=2000 then
9 E6 c3 ]) `$ I0 [7 E3 u       print qi=5;: s  K1 P7 Q. t1 C
when Ci>2000 then
! V' S$ \0 p" t9 f       print qi=6( l4 i' U- P* l2 i! p6 ^9 J
end;
6 S# }. _' `6 X- d# {end;' `4 r& B9 y* B% T

! j% \. {. Z6 @          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
! K; m+ c% H7 M( c8 U+ q          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:+ z: a+ s9 @' D
(number : integer); i% U! l! U* z7 Z/ k& F: X2 U% ^
is
, w% t, q, r( B3 o2 tdo+ Y1 ]* D" m$ W- Z# z
   inspect number- a; P! v% |* e' _2 {
       when 1 then
- u. r6 W# s7 H( b          print "not a prime number"+ r0 S) P% x' f6 i& y- w9 o/ T
       when 2,5,7,3 then / c# E8 {: s( k$ Z6 m! N/ A$ Y# ?! g
          print "prime number"
* n: U2 x% d1 F       when 9,4 then 7 `% V" v3 i. a* ^  H. Q7 H& B* Y
          print "square number"
) d' t& x$ P% V6 {" @       else
* b3 h) J( P: m2 @+ E9 x          print "no special number";. B( c5 O7 J  P% n
          print "or number greater than 9";0 Q" A4 W& @5 k2 E
   end;* B! t/ h# |9 b. g; y$ k
end;
 楼主| 发表于 2009-5-13 10:00:51 | 显示全部楼层
我在做一个集装箱码头泊位—岸桥分配的仿真优化模型,我是新手,有很多问题需要请教,高手liysunny能否帮忙,我的qq:540966007。谢谢!!!
发表于 2009-5-13 17:55:54 | 显示全部楼层
发表于 2009-9-15 10:16:40 | 显示全部楼层
楼主Ci没有赋值,应先赋值,再判断
发表于 2010-10-19 09:44:36 | 显示全部楼层
二楼说得很对啊,版主为啥没给加分呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2026-3-16 03:20 , Processed in 0.013927 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表