设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7420|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is5 C' u8 {$ |5 k4 A4 C
       Ci :integer; qi : integer: s$ ^1 w) I: V' C1 J1 f/ c* H
do ' R& ?4 m: p1 [2 V
       inspect Ci5 A- A" _( ?' \; |  z$ _( K5 c' \
when Ci>0 and Ci <=150 then ) e5 j* `3 M' d, E
       print qi=1;
  |! P( }0 N8 S- Qwhen Ci>151 and Ci<=500 then2 w  ^# N. _8 v
       print qi=2;/ K" m$ t0 t7 m$ `6 g+ T2 Z# {3 T; f
when Ci>501 and Ci<=700 then
/ z5 b+ c  `8 B+ _9 a* G+ q3 E* ~       print qi=3;
6 L% e0 V5 V; p# bwhen Ci>701 and Ci<=1000 then
/ M  K5 [$ v: `# D2 W  b) _8 ^% ?       print qi=4;
' k+ M% j3 O/ U( F& a# jwhen Ci>1001 and Ci<=2000 then5 u0 t. S* W' n+ X+ O
       print qi=5;
/ C5 f1 c3 o: M% s, [% W( Pwhen Ci>2000 then
" I% J0 x( u+ }* b       print qi=6
6 `8 Q( w& \+ W! u: U3 iend;9 }! L2 z$ ]& |; P, j! l7 N! [9 T
end;
1 ]9 M& P0 A# s' J% M7 R& X. [# `6 [/ k3 n8 q7 [
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?5 o' _- u. ~! @  G& b9 ]9 p8 \
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
7 |3 @, |' T; g+ B8 ?(number : integer)
3 I* K# ^9 }; J1 `) H' o% Wis
1 z  i8 R$ u6 `$ xdo
) e( ^! b, c" o) \) x2 A; O   inspect number
/ q8 V& d/ P# O& ~' l# a% ?& R       when 1 then ; |4 L0 k4 @# I, @1 k# Z
          print "not a prime number"
2 N/ m0 T0 t% v4 A, V- s  h       when 2,5,7,3 then
6 j) ^" h% `  u0 ]) |) f, M          print "prime number"
8 F- Q0 b7 a2 \! N8 J. ]* [       when 9,4 then ) S. |! W: l+ J6 z8 w8 \7 V; z, `
          print "square number"! B* X2 E' H. [4 u( f
       else
; p. V! [( d% T" |& z+ f          print "no special number";
- u3 P. I. ~3 X  S4 l          print "or number greater than 9";
0 ]" b; g: q2 A   end;
0 v0 V: S/ M- I+ _& s* L; Xend;
 楼主| 发表于 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-11-21 20:50 , Processed in 0.018132 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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