设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8245|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is/ R0 }* F  I2 k  Q6 H3 {
       Ci :integer; qi : integer' U1 r, `: h3 E2 F( ?9 S9 Y" G5 y
do
! T4 }. P' e9 Z       inspect Ci
) b6 L/ m6 \, }$ q1 Q" g2 iwhen Ci>0 and Ci <=150 then
1 B0 E) a) Q4 h, h5 E. @       print qi=1;
, N  ?3 v( p3 \when Ci>151 and Ci<=500 then, Q: m. ^( m# W: w6 |" p
       print qi=2;
) t2 b. \6 k+ {$ T3 xwhen Ci>501 and Ci<=700 then, _- |4 @1 ]5 }6 |! Q, p7 z. {6 L
       print qi=3;7 o8 P  G; f5 R3 J1 I
when Ci>701 and Ci<=1000 then! U4 U7 {  G  F
       print qi=4;+ Q, x0 p7 [2 o' }0 o3 ~
when Ci>1001 and Ci<=2000 then
: A: v+ D' F& p5 `       print qi=5;% ?' P5 a- T. r$ u  X
when Ci>2000 then' s- M' {" S9 s2 {8 t/ {
       print qi=6
- ]1 J2 s# W, |. gend;
* s9 W/ @! n1 vend;5 M- g% m& B+ R; z4 g+ M, T
, X' a, P1 E2 b
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?  H1 |: z  a, U
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:4 Y3 `) S# Q0 u3 |* y8 m  F8 ]
(number : integer); Z2 O. b7 }" U* x6 P* G$ x) S
is: ]2 k0 ]9 n9 s- }- h# Z
do
4 A& \0 W4 f, U1 B   inspect number0 D$ a* r- {) [- B
       when 1 then
: B; d8 c- ^+ ?          print "not a prime number"2 P% e" n) e& o$ y& m
       when 2,5,7,3 then 8 p9 I. @) }! Y+ o* T
          print "prime number"
8 {9 J# k% M" c1 ~# F       when 9,4 then   f0 |* z9 ^. v& A2 b. u
          print "square number"
0 ^2 l) b$ j  n* m8 J/ ^       else$ F& w" z7 x4 T% S& T: w
          print "no special number";8 Z* v, u1 b$ K0 V" t8 f
          print "or number greater than 9";; v1 k8 C: t: `' J; a. [
   end;
) X$ t2 ?/ y% aend;
 楼主| 发表于 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-7 23:21 , Processed in 0.016643 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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