设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9134|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
/ ]/ \- }1 g  M  Q" C' N1 @       Ci :integer; qi : integer+ ^& D) c3 }; {" i4 ~* N* L% x9 B
do
7 p, v4 Z" i! U$ S* X! T       inspect Ci" \* q* r% Q' A1 t
when Ci>0 and Ci <=150 then
/ o) U5 w6 D9 v% x9 N       print qi=1;6 o9 K" A- r+ G9 q  a$ `& }
when Ci>151 and Ci<=500 then$ x$ W3 _) K3 J+ n- ~
       print qi=2;9 w7 S' r0 L& I6 p
when Ci>501 and Ci<=700 then
6 l' [; m$ ?; y1 X  i% @       print qi=3;
* n+ S3 v7 Y: Swhen Ci>701 and Ci<=1000 then
. y6 K# @* H  Z. i1 ~" h! a       print qi=4;7 M' [" h5 Q, I. O1 j; |
when Ci>1001 and Ci<=2000 then
: C8 `. X* v2 h/ f       print qi=5;
, @0 H" r1 K3 o9 w1 g- f& }: |& pwhen Ci>2000 then9 j! A6 ^2 T0 @# l6 M6 y! f
       print qi=6. o  _' M/ k: t- d' t6 K' r
end;
9 }+ p/ T1 X  yend;( I) m4 B" ~# g2 h4 f5 Z

! A9 d( p& H* q* W          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
" S2 _. F" L+ k( X          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:# ~. ]  M+ k1 X: ^
(number : integer)9 I- @5 @8 w6 g; c
is
" ?' P4 i4 J0 E! Qdo
8 u$ O4 X7 i: _" ^* ^   inspect number
9 K, }. Q( D) I7 R) ?1 @) s       when 1 then , h# j: R' y6 |7 e; k
          print "not a prime number"
) \' Z" `1 P9 n9 Q- I) J       when 2,5,7,3 then - o! o8 V3 h) G7 B) R4 N
          print "prime number"$ f6 t% A$ Q( Y# z8 G; V2 Q
       when 9,4 then
# {" Y, H& \1 B          print "square number"
5 `. y5 n* N  Q3 j% {& ^       else% F  }/ _4 Y' x) f/ v4 Y
          print "no special number";  [& n" ?3 S2 p7 S2 T8 }  `7 D
          print "or number greater than 9";
; s8 O8 Y/ j7 q7 \  M* [   end;
7 Q, b- c% w( s9 q# G7 S3 t3 }( nend;
 楼主| 发表于 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-8-1 21:09 , Processed in 0.022774 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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