设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8444|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is1 ^  t! w8 c2 d8 ~6 f) |8 c
       Ci :integer; qi : integer
7 Y, U) f! W1 w: z- L5 pdo
5 D% h2 Y3 d- f( Z       inspect Ci- p* j, ^! G& J6 C4 F* d
when Ci>0 and Ci <=150 then   K' m( I7 d; ]7 \
       print qi=1;$ o( X! D5 N, y' c
when Ci>151 and Ci<=500 then
. `& \* h* v+ ~1 D/ W       print qi=2;7 W5 x' |; P0 e+ O  N  ]
when Ci>501 and Ci<=700 then
: I/ Y+ e5 ]6 Y& U       print qi=3;. Q  |6 B3 B4 V, n5 a6 M$ t
when Ci>701 and Ci<=1000 then
2 b0 ^& e0 A0 }+ F- O1 Z$ v3 q       print qi=4;
9 w7 ~( c. ]( a) O6 Z- B. U. Zwhen Ci>1001 and Ci<=2000 then8 I5 M! t5 b/ w# B
       print qi=5;: ?: X( `& G# e9 x! e  F# I
when Ci>2000 then0 ]6 u, O" S- R1 F$ l/ D2 H
       print qi=6& D/ Z5 i' D. k' d* L
end;) s2 w. S* P2 N7 D, J6 r' W) l- X: d
end;
) b- b/ z1 d  Z' Y
6 D8 y0 P  x$ X$ {# U$ Z          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?- s/ d  L9 S6 c  w( W1 x
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
; D7 T7 m1 \) Y, B(number : integer). j" k/ {* M5 \5 A( i4 w  S) f! E
is9 ?$ U/ g% P5 w4 u
do
& t7 Y% A8 Z& t2 K8 x3 m   inspect number4 J- K' C: J% d
       when 1 then
1 W( Z1 F) D! X) G2 b. D7 H. v          print "not a prime number"
3 ], z$ H7 Q2 C) `' e* h       when 2,5,7,3 then ( x; b, M, y0 t$ @
          print "prime number"/ _% f: d- u# g$ r7 Z
       when 9,4 then . f1 a2 @0 Q8 E; J% I0 K
          print "square number"
( I7 ~/ b9 ^+ Q  ~       else
' ^7 Y- M/ |' f$ A          print "no special number";
. z, G2 q% e7 t3 Y          print "or number greater than 9";
9 }. H) J/ k! R; X/ p, \* ]   end;
% F6 Q# B# G2 v- u: N7 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-4-27 16:46 , Processed in 0.017720 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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