设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7948|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is' H5 }" \# ^& z4 S( b, C$ @" C
       Ci :integer; qi : integer
1 ?, q- b* H& edo 4 v/ N4 h, u  `- I. b6 Z6 `
       inspect Ci4 ?6 S7 p5 \0 y4 }/ Y
when Ci>0 and Ci <=150 then
2 [8 C& C. {. p* W2 ?% k& E       print qi=1;
, J3 x2 c2 N* s. ?- g$ ]7 lwhen Ci>151 and Ci<=500 then9 c( B# Q% j" Y* K+ V* x9 u* b
       print qi=2;) }& r6 \' |6 A  }  Y
when Ci>501 and Ci<=700 then- I/ K8 i# u+ O8 r, N- h) }2 D* w
       print qi=3;& j( l/ `+ `; L: o# G3 K  ~
when Ci>701 and Ci<=1000 then9 N/ E- K# Y6 d  Y; o/ I+ R# B, o
       print qi=4;- p6 p0 n7 f2 ?% [
when Ci>1001 and Ci<=2000 then& x5 @. x% E% q7 U) h
       print qi=5;
2 v7 F- ~, `( ]* |% Mwhen Ci>2000 then! |9 q) t' S- a( [- M% \
       print qi=6
& o: V+ |$ ^+ f2 aend;
2 p: o+ R( C4 fend;
- r% ~$ |, C# k# \0 ?
. g! T# p4 @* Z6 O; I) L& N6 P3 P          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?: g( u$ h4 U9 h/ m- U2 c
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
  n& v  i' K; [( ]& f(number : integer)' z9 D+ q8 C) h$ v' h6 s
is
5 ]# h3 c. R5 O  ~; r; R+ J7 `do8 j% [7 }' J) R2 G' o: M
   inspect number' z) @1 a3 u0 N; x- F: R: K
       when 1 then / x1 w& C, H! F' U6 \
          print "not a prime number"( r7 ~4 c8 l6 C- r$ j) }+ W5 G
       when 2,5,7,3 then 5 d9 K: T- t; [3 e  f2 Q% I7 m; p: X+ Y
          print "prime number"
2 M$ e, _! P* n! `2 C4 C. a       when 9,4 then
, k. {& H  w9 N  ]3 A2 K/ ~6 y          print "square number"# u" r) Z' B! a% ?$ w
       else
" K) \; N) }7 Q) X& L2 {          print "no special number";
) v+ J, e, G5 V. q9 H6 `* q          print "or number greater than 9";
5 ?$ P2 C! M/ h1 v   end;
* d/ O! `$ _! \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-2-20 18:31 , Processed in 0.014682 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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