设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7725|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
3 Y- U" \4 ~: ~. o8 j. K/ e       Ci :integer; qi : integer# s& F, n/ F0 c& z$ D. U/ q* k: Y
do
7 P0 g5 D6 @! X% V% M1 g       inspect Ci* B, z5 r/ N& {
when Ci>0 and Ci <=150 then
3 v7 g/ c6 y0 }; r8 ~2 U       print qi=1;- S5 x& d. V7 Z5 |5 @5 n! L- e
when Ci>151 and Ci<=500 then
# T$ t1 y9 v3 y& Y* k$ d7 q# Q6 \       print qi=2;
; H: W% b5 q0 R1 q. Gwhen Ci>501 and Ci<=700 then# ~( k! V8 b" r, P9 e+ {# M+ Y
       print qi=3;. D& _2 }  u; ?3 U
when Ci>701 and Ci<=1000 then
- P/ t& }, `$ l; Z' ~' v4 Q% p+ a       print qi=4;9 `1 h; M8 a2 @: x: G0 X4 ?& n
when Ci>1001 and Ci<=2000 then
8 z8 q' t! x9 |2 N4 k0 u. M       print qi=5;
1 r6 J- W5 t1 s5 hwhen Ci>2000 then6 k4 F0 E8 l$ w- }+ {  R
       print qi=6) I; B& c4 o( u  I  ~2 B
end;
& V' C5 v6 o+ T$ k6 D5 A1 \" y; h9 nend;5 t, P( \: I; A, n& Z: j' k% V
: l. e1 c3 J1 x: [! n1 X
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?) o8 {, N9 z$ b& ?! E% y8 o
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
9 G* ~8 h3 \/ X1 ~8 T9 ^% M(number : integer)7 Y- b& y8 U/ {# v6 q' ^% m) J
is4 M; f# I" w& Z3 G  t  E
do
, n% r, P* E+ c2 I: @1 N   inspect number
- [8 w! F+ t2 r5 `3 ~) ?/ L5 j' s       when 1 then " S& b: V0 f" g" @0 A
          print "not a prime number"' R- v- W5 P/ D7 H8 J, a
       when 2,5,7,3 then
3 E3 g) o; E! Y7 Z8 j$ w, T          print "prime number"4 v+ Y  \2 l/ e
       when 9,4 then
2 u! y! q- w/ S+ L/ w) f          print "square number"1 @9 k0 C; U6 k# @
       else
) R: d: x& `3 o! O  [$ l! E          print "no special number";
) F' I* \" q6 J% ~          print "or number greater than 9";& B1 o  s6 e8 t7 D# d( K  f0 d
   end;
9 i- H+ ~5 O$ i, ?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-1-14 13:57 , Processed in 0.016960 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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