设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7292|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
( d  a7 J  m  b8 U1 Y       Ci :integer; qi : integer
# R9 T* w2 w" T+ ^do 1 Q9 f. h3 ?8 @- f) `
       inspect Ci# W' q6 j8 [6 e9 {: X
when Ci>0 and Ci <=150 then 9 p, X3 P( D0 i* {' J
       print qi=1;6 ]0 M# s4 I) D% C2 |: s, ~( W
when Ci>151 and Ci<=500 then
8 \& p8 n2 E7 A, r( o       print qi=2;
( S" L+ \* B  e% |# gwhen Ci>501 and Ci<=700 then
' |! r0 M/ B# B       print qi=3;
+ T. d- p  t% ?* ]+ b. H6 fwhen Ci>701 and Ci<=1000 then
" Z+ ~8 Y( x% x, Q0 \: u  M       print qi=4;
% s! f4 N3 E  b0 Y' a0 G5 Awhen Ci>1001 and Ci<=2000 then
8 B6 f9 ~) s: \- G. A       print qi=5;
- R* _, l  P% ~0 A6 e! Y5 i$ nwhen Ci>2000 then
/ X* m3 a& [  Z- ~2 O/ u3 A) D& f       print qi=6
+ I/ ^1 B5 C6 a  pend;2 D4 w4 z3 o6 Z/ R* E8 ]8 ]
end;2 M! {: r# J4 }) x
+ Z/ Q3 R9 Z" u7 ?
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
4 C* \% ~  \7 n: @          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
( S4 }6 ^! L0 U1 B, o* n5 [/ _(number : integer)
# ?' j+ y, d. @3 ~is
1 i! e2 N) [# K5 {+ Pdo
* T: x- L) J3 k; R* S   inspect number
( W; ^7 x' u+ ^! n. G       when 1 then # _, a' ]7 I% q+ F; ]1 Z
          print "not a prime number", L" o8 P# B0 v) s( m" \
       when 2,5,7,3 then ' z' j! B# ~- U1 }
          print "prime number"
7 K# z% x7 ?! t$ ^7 O       when 9,4 then 3 {5 Z% ~8 F) G# K4 I* h
          print "square number"8 d1 @0 v- c. B' U1 |, k) N: x
       else
" J8 ~9 t4 R- k$ x) ^) x; ^# Y, `8 z          print "no special number";
: K0 w# t/ C* h          print "or number greater than 9";; x! v" [. s: y; B
   end;
9 |9 C5 C, q) q# j# iend;
 楼主| 发表于 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-6 03:18 , Processed in 0.024458 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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