设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8694|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
" i5 \& i) r9 X       Ci :integer; qi : integer/ J+ u+ s2 I1 j# Y. D( ?
do 6 r; d" o, W6 Z! e/ G8 Y' x# L
       inspect Ci
! ^* b  P) h  j% F; j- k$ lwhen Ci>0 and Ci <=150 then
9 z, H* W$ j3 a5 F, z) ~, T       print qi=1;2 d0 Q. z. U6 ?) j! A( n2 Z9 `, ?8 c
when Ci>151 and Ci<=500 then9 s7 J- t: ]" w
       print qi=2;
) a2 r6 w9 u4 T0 u8 a. owhen Ci>501 and Ci<=700 then
' B8 v$ M. W' l5 Q$ B5 L       print qi=3;
8 H6 r( L; E+ ^# @" gwhen Ci>701 and Ci<=1000 then" v& g) n/ w# {# i5 \5 y
       print qi=4;$ r. l9 s% _4 }, ]
when Ci>1001 and Ci<=2000 then
3 B" R- z, B. |6 u* Q$ Q  |- x       print qi=5;
, k# J5 q3 F1 {) S7 k8 O- cwhen Ci>2000 then" H  H5 e, A' i) |# M- i2 T* n; w
       print qi=6
, ~' b3 e8 z2 O+ \end;$ D. g. R; N7 i  y- F4 q1 I+ G: e
end;
, c4 ^: ?! }% `& l1 }
- _5 G0 X% \$ m! B4 }% o: ^          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?+ l. w" S8 S9 o3 @4 v; I4 e6 p
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
7 T2 G+ o1 c3 C0 J1 V) Z1 Q(number : integer)/ ^( U9 G) a8 [0 @" |
is1 j( }2 O) u$ `5 |6 z* A
do% V5 m* V0 U6 ^- \& y/ P9 S) k
   inspect number
1 g9 L1 v( y  c1 f, w6 D  g       when 1 then
, h) v$ h3 |3 @          print "not a prime number"* Z" M9 m: h  k5 e
       when 2,5,7,3 then
& ?" n# r. u& {4 A* x# ]          print "prime number"
3 d0 R0 |( w3 d( z       when 9,4 then 0 c% M8 k$ l& c2 }) j9 @% \# w( e
          print "square number": v3 d$ D5 Q) h1 D7 N$ z
       else! R8 a6 t4 S' s+ J
          print "no special number";
% h4 g7 x6 j0 E          print "or number greater than 9";
* S4 k8 n; b) T, d7 f9 Q  S8 r   end;; x0 a9 e& y% i8 e4 {+ h8 i3 c% V
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-6-9 18:50 , Processed in 0.015578 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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