设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6510|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is" {! m( v4 H% r% I
       Ci :integer; qi : integer
% v' P$ W2 D- K% `: _. Q6 d% rdo
3 j" M1 Y- p- B/ S       inspect Ci, w7 i$ u& c1 _' w( C# s1 h) }7 Q
when Ci>0 and Ci <=150 then
1 }; l' `7 V6 O, f       print qi=1;
" d5 f4 v: K3 q( v  Q+ ?# Awhen Ci>151 and Ci<=500 then
1 I0 c5 T5 w) J& K       print qi=2;0 t+ S8 ]9 F+ n! R
when Ci>501 and Ci<=700 then+ {+ L/ G! g  ]+ Y: F* k
       print qi=3;
/ E8 V, k% R! u& x5 j$ i  X! zwhen Ci>701 and Ci<=1000 then
$ _% l+ b! x0 I3 V       print qi=4;$ g  P: f: |7 U8 b0 E
when Ci>1001 and Ci<=2000 then
: M/ @( s, K$ V: n       print qi=5;  ^' W( E) Y$ z9 Y
when Ci>2000 then
( M$ ^. |; M" P, Y, L: O       print qi=64 X* F8 B, _" i0 z6 J! _8 F
end;5 d* l( z5 Z5 w$ Y( A
end;. w- w0 v4 }5 R2 q  K2 \
% x" \; T6 q1 }! H! N
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
+ l* a3 M; [5 U" X7 _+ t          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:0 T  B9 q- B8 }
(number : integer)7 ^/ R% s) i1 ^! I9 a& M
is
5 z% E/ H/ f2 d% kdo
" p+ T& p, h: _5 }) p( {+ @0 P   inspect number
5 b. D! I: S" t; X, J% Q       when 1 then & o- R) L" S4 v3 |2 p  G; p" `" f# r
          print "not a prime number"
" n" I" L, X. b5 _$ w       when 2,5,7,3 then
# Y) n. k1 S$ u; x          print "prime number"
4 `3 |  G* D3 }- o+ g3 ]       when 9,4 then
2 J" i( i6 K% X* Z- T5 F          print "square number"
6 x* C& }. m8 t) P9 x9 j7 ?       else5 h- b( G" B. _& |- K: q
          print "no special number";
+ b4 l4 J- Q3 i! t+ X2 b6 a          print "or number greater than 9";
* l% v4 ^0 R9 J$ l" S" z; H8 `   end;- C/ |5 @. H0 T8 |+ v4 n$ H: B0 I1 s
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, 2025-7-6 08:06 , Processed in 0.013021 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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