设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8522|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
- ?9 ~0 k: g8 K# M+ }% v5 Z       Ci :integer; qi : integer# G  F) z) r4 `- T3 x9 \
do
8 m8 J# T+ ^; M! F       inspect Ci
6 I9 h/ t) O  |  A: pwhen Ci>0 and Ci <=150 then " ]3 d7 F# g% A: N  k$ f7 m! z
       print qi=1;& @# Y9 ^" Q# ^5 w$ p/ U3 J
when Ci>151 and Ci<=500 then! f1 ]: w% P* b3 G$ ~  m# \2 Y2 b* V2 i2 ]
       print qi=2;
! z& }/ t. g+ V) u1 f& x8 l# {when Ci>501 and Ci<=700 then
7 d2 `& J& b/ y1 y/ H8 Q       print qi=3;
: {& T& L# X0 \7 J& @when Ci>701 and Ci<=1000 then4 L7 h. h0 i3 C/ N' Q1 K9 b$ S/ W
       print qi=4;( q( i, V) x5 G
when Ci>1001 and Ci<=2000 then0 f6 @/ N2 M5 G
       print qi=5;
7 l' j' l* M& A. J/ @when Ci>2000 then
6 M& l0 T6 W( i4 A! w) N2 w       print qi=6, H+ t/ i- ^4 Z7 ~$ Y8 ^
end;6 s9 g) J- ^4 B: W! j0 i' Q
end;6 {# E4 t; j1 H3 l8 F0 r
9 w( @( f2 c, g9 ~( x* S2 q$ e
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
2 d1 e8 D6 k0 L/ r/ f6 Y' U          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:' \9 ^+ b6 q0 S
(number : integer)- p: [6 w* w' V+ W2 K
is  y% u+ t4 n; x$ I- j
do
' A; S) ?# w+ a8 }+ K, e  K& @   inspect number
7 T) U6 V! `6 e! u       when 1 then 0 A5 l" X/ |: y
          print "not a prime number"
# C$ [  ]5 |, G' c% c8 C7 Z       when 2,5,7,3 then + p- w; {# E  e
          print "prime number"
, }0 Q- _- ~. [6 c8 t       when 9,4 then + V$ `3 {/ A& a, Y1 R7 I0 N
          print "square number"8 q1 W( e- l! Q) D
       else# e3 }  }9 ~( [1 d" P, O
          print "no special number";- {& O$ C% _8 z* }/ D& r1 A) b
          print "or number greater than 9";
6 Q: A) H$ y1 m/ \# N   end;
% Y8 B1 ^3 y1 V, E. w8 i, Q- i- Pend;
 楼主| 发表于 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-5-4 02:19 , Processed in 0.016129 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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