设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8479|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
5 ~- D) M) d$ `0 ^$ b       Ci :integer; qi : integer& ]& C9 ?  J6 c: \+ Y* x7 u
do 1 I2 r- y" l; [7 k
       inspect Ci% j7 C3 D/ r/ C" c5 |" C
when Ci>0 and Ci <=150 then
% M3 F- g4 v: z; Q       print qi=1;
( o- m8 [. i, S# H# v' X; \when Ci>151 and Ci<=500 then
5 U9 ~& |4 v. M: s( a/ g% H5 T9 f       print qi=2;
6 B, U- W8 _' v# E0 k9 o/ \when Ci>501 and Ci<=700 then" |5 `$ k+ v& T9 u' d8 c
       print qi=3;% M" K1 _# u7 O7 a0 ^( ]' g
when Ci>701 and Ci<=1000 then
9 n" u; T1 q" B       print qi=4;3 v2 A7 \6 [5 n% q' g3 b9 ^7 W" o3 v. h
when Ci>1001 and Ci<=2000 then0 G( z; |* h! P- D  |  N! k
       print qi=5;
/ y1 h8 D7 t9 k. Ywhen Ci>2000 then
1 M, k9 r, X4 f, ]       print qi=6# V( d9 e1 c# E3 R5 s* o
end;. W: e( g. y! _2 n
end;* Z8 d( ]6 ~8 k- t0 Z' v* p

6 _# ]2 B1 s! l9 ^3 T, f1 E( \5 a          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?; b+ n) H! ]( w+ X" v! H: M
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:8 r4 {# e- b7 Q1 c. E. J
(number : integer)
5 ]3 {$ J: q$ Q) P$ Dis
* L- b# g0 r# K8 \. q- q' Kdo" u1 Z1 `) \( n; W! _9 K: L
   inspect number$ v9 p  t) m+ m4 o/ P/ h' b* a
       when 1 then
/ S4 Q5 F$ w$ |8 }, X$ J4 Q9 t          print "not a prime number"8 a. y4 ~# b3 Z5 S3 t
       when 2,5,7,3 then # g  V1 O( ^. R9 a6 u
          print "prime number"$ ]5 d9 F1 a2 J, ?5 o
       when 9,4 then
2 ~! d- s) o$ M2 V1 W3 i" }          print "square number". T# c, J. A. M0 \9 a$ O4 W
       else8 w7 Z" Y/ a6 O* F: D) r9 s
          print "no special number";
: V1 j. f, A' J$ V% d          print "or number greater than 9";
5 I) B4 {& L% _; @. P+ [   end;  g' z1 U) F" H0 J; f9 \
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-4-30 23:58 , Processed in 0.014673 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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