设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6906|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is& q  d" G+ M; |: Q
       Ci :integer; qi : integer
0 X! o/ I& _, ?$ t& B0 |do
# Q4 D; F  q6 m* _7 C+ c4 }       inspect Ci1 e1 Q0 o0 ~+ t, O5 }; d
when Ci>0 and Ci <=150 then
9 O+ Q/ r9 J$ }# V       print qi=1;) b, C- P0 c( B; I, m* O
when Ci>151 and Ci<=500 then/ x: P1 r. D/ R3 ^* {1 A7 u1 P
       print qi=2;9 l8 [6 q+ v2 m2 x( r
when Ci>501 and Ci<=700 then
6 O: O$ U1 {! o1 V       print qi=3;7 Q$ x" v& K. L  u3 M
when Ci>701 and Ci<=1000 then
. V% A8 `) K2 J% ]0 k       print qi=4;
# K* i' m2 n: A, U" qwhen Ci>1001 and Ci<=2000 then
$ t9 d: z9 i1 X/ g- v4 T' C       print qi=5;
. w& i) I' Y' o4 P8 owhen Ci>2000 then
9 X  ~; q3 r$ U% c       print qi=6# K7 u0 x; y9 z8 u6 Y
end;
( d, q( M2 J4 \' V5 e4 send;8 V' d+ [- E0 N1 T1 q" e

5 `8 S8 z! Y5 _1 o" x9 e          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
/ V, x+ d: `/ M$ M$ W          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
9 U1 w3 s+ Q) T$ s+ z7 `(number : integer)
4 g7 T3 f' s9 z. y2 l$ m! N" ois7 q1 \1 g& W1 n3 d/ R: M! I' O
do5 o) Z* H6 f; D5 f& L1 h
   inspect number
$ v" [2 i4 |7 R" @9 }, W, Y7 L, j       when 1 then : z; C* L2 z# y/ }8 m
          print "not a prime number". e- d; X4 ~9 L
       when 2,5,7,3 then
1 |. W" M0 ]. H3 |9 R- |# o          print "prime number"
% N/ Q$ ~) K$ E% @0 T       when 9,4 then + a" m8 O# n) \$ Q2 e
          print "square number"8 f6 N4 L5 v$ ^  B' l, d+ C2 [: }
       else& c) r7 |( M1 `- v  z
          print "no special number";! H, R* i0 u% R7 e! X
          print "or number greater than 9";! I4 b) J; f- K
   end;
3 t  Z* D" [8 j  Aend;
 楼主| 发表于 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, 2025-9-11 05:49 , Processed in 0.013735 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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