设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9351|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
) h" D7 W' u& x1 V       Ci :integer; qi : integer
  |4 g) C9 H+ Z0 Y" _+ B2 w( u. |do
) @) U: h2 r2 K: }       inspect Ci
! {7 A% \. V  x% vwhen Ci>0 and Ci <=150 then 3 i0 [1 _' a* K" H( C, T
       print qi=1;! h. B% e4 `. {, ]$ p! K3 ^
when Ci>151 and Ci<=500 then, U1 X, k$ e$ Y9 ~0 V
       print qi=2;
* C( e6 y/ J" ?% C4 W: Xwhen Ci>501 and Ci<=700 then
' M) f; X6 y: v4 k- D: c! K       print qi=3;( ?7 h- y+ m, G+ N  k  H3 U+ X
when Ci>701 and Ci<=1000 then
& q7 H  v# Y5 o) b" s& n8 S! R       print qi=4;, ?0 M/ D% y" R1 J7 m6 w; x
when Ci>1001 and Ci<=2000 then9 d: p. Y5 _5 h6 @2 W
       print qi=5;
: q  U4 s4 b5 y. s; y$ l% Awhen Ci>2000 then
* D% n# }. O% H4 i* Q2 {       print qi=65 f) I1 ~+ N  g8 S& T9 n2 Q
end;
; s- r. p, p' u0 `9 D6 Lend;* q* Y, T) W  x! \. p/ B

: K+ I  g, G, k          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?' z; @" C5 C1 y, Z
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:- L  Q4 j* Q3 P9 ?; H) y
(number : integer)5 u" f8 ^1 p! [/ M5 a1 P6 f
is
1 D" G! _, w5 O+ [' F8 V! m! p; kdo! i9 d( R& d" F  T( f( J$ l" j
   inspect number
5 d# d, F3 v7 C! F3 Z       when 1 then
  D" y0 h& T8 r/ A  ~          print "not a prime number"! ~$ L' K+ {, [" Y/ i1 a
       when 2,5,7,3 then 9 R& D4 u+ B6 H% Y( d
          print "prime number"
1 I7 Q% K7 k, f- G       when 9,4 then
+ D' D$ c0 O6 Y8 X- \          print "square number"
3 O& r+ f; n# m5 d       else
7 h4 R- \8 M. J! k" t  b( o4 ]/ m( K; Z          print "no special number";$ y9 r0 G: a9 M. b& }9 q  s1 r8 w
          print "or number greater than 9";
- F+ G" t! r! G6 d   end;) V. {. L9 q+ S3 z- i9 S
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-9-5 17:45 , Processed in 0.030860 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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