设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9390|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is3 E6 A* ]* A2 E0 p
       Ci :integer; qi : integer
1 w: N2 Q! R4 d- Sdo * ?$ V3 H/ a2 S6 w* G7 m
       inspect Ci- ~: v" c" }- `- U1 T# u
when Ci>0 and Ci <=150 then
5 f9 c) R. R3 C9 i9 u4 d       print qi=1;' S/ R+ j( y# X% M
when Ci>151 and Ci<=500 then+ {7 ?: V9 n' O
       print qi=2;- I' q# [$ r; i. ^. m; G
when Ci>501 and Ci<=700 then
9 I9 h' G8 ]. @: k       print qi=3;
2 U5 O$ B# c* V- swhen Ci>701 and Ci<=1000 then
0 A  p5 W" m: N# t" E       print qi=4;
  ?1 T1 M9 B( X' E9 awhen Ci>1001 and Ci<=2000 then% D* w+ `. o8 }. N- D
       print qi=5;! c7 J& q9 q9 C1 b/ {
when Ci>2000 then
' j" p4 q3 \4 \* p' k: m       print qi=66 n5 S  B0 V5 L$ ^+ C& @
end;
0 ]1 E  [: N) x$ W+ U: M$ {end;  ?+ ?# r  w! P6 n6 R3 }
/ g3 X* P$ F. I2 \! s5 W
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
7 D/ r; O6 Z3 q9 V" r' G- M          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:* N/ h5 }+ V; B9 W* I8 B
(number : integer)4 W* Z& h0 k3 C8 i4 C
is9 g+ h: D3 n+ i. g3 x6 w
do  e" i- c5 W1 {
   inspect number; S+ d0 \3 k  y) ?, U% e8 s! c3 A" m
       when 1 then
6 A4 v* T. I3 h; x1 _          print "not a prime number"
- f* z2 _; q9 o7 i5 [       when 2,5,7,3 then
. d/ ^9 g+ w) R          print "prime number"4 k( p  W0 w5 x  f. ^3 j
       when 9,4 then
- I1 t' ?& s1 v  Q( j( s1 S          print "square number"
- R7 ^; g. t) f- W+ u4 N  ~! l       else, q. @9 q9 J" n1 p
          print "no special number";, ]; h, P! S( n3 W' ~0 I
          print "or number greater than 9";2 t+ N8 a6 ]( H/ D8 t
   end;
* j9 y* c# g, o! f7 N$ send;
 楼主| 发表于 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-9-11 16:14 , Processed in 0.019555 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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