设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6482|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is. W+ u4 ^+ I4 Y
       Ci :integer; qi : integer
$ x) r' }) t- Jdo
$ b% L' ~* ]8 y; m' u       inspect Ci5 K& A2 f, T& ~5 S" Q" x
when Ci>0 and Ci <=150 then
- n4 ?8 E6 J$ G2 O2 _% b       print qi=1;
- C5 B7 M6 m( V" N5 j0 Bwhen Ci>151 and Ci<=500 then2 I: G( j1 Z8 y/ Q. j8 d
       print qi=2;
+ D$ o8 |; h0 [5 w3 awhen Ci>501 and Ci<=700 then2 @& L+ K! y2 f$ J* A% R
       print qi=3;
3 k' Z9 h( x- r( {% C  Fwhen Ci>701 and Ci<=1000 then6 H. _0 O: J0 C& h
       print qi=4;( y8 u! W) p3 c* W* X5 f4 r3 b/ V
when Ci>1001 and Ci<=2000 then
8 h9 A/ d& L7 b' k4 j* m9 M! a       print qi=5;
% t0 g  G, s8 |; d8 Z$ iwhen Ci>2000 then6 P# o  K9 d" K% \0 s
       print qi=62 x* I! @$ x6 B  t
end;
7 H: q% r, ]3 Y7 ^. W9 V+ O0 g9 Nend;. F% c4 S# ?  z) |/ A" \! Z4 @
* |- T: K6 T3 ?9 I$ _6 j$ h
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?( {4 m/ d5 s  I
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
5 Q6 J* \. w/ [+ W) ^, U+ q0 b& ](number : integer)2 Q3 @( L3 |- Q1 C8 w
is7 D& c+ L0 k! G1 [- \
do. q" ?. `; C9 h2 |2 T
   inspect number
8 U, G, G- ]( v. N       when 1 then 4 b5 {6 n' X- k. O
          print "not a prime number"
: Y2 o+ |3 J$ y$ _; b       when 2,5,7,3 then
5 t- l& Z; B- z3 L8 [7 X          print "prime number"
+ Z4 O3 ]* b2 s( x+ Y2 M       when 9,4 then # `; v8 p3 n) ^: E4 p7 u6 B
          print "square number") @, U6 M# K1 d% t/ S; N6 K
       else1 R9 f3 {3 ?. \& @1 d
          print "no special number";
" u3 D/ J$ V* W# l- K          print "or number greater than 9";! f9 r+ d9 {8 k
   end;
1 L; q2 N- c2 uend;
 楼主| 发表于 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-7-2 19:02 , Processed in 0.013731 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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