设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7671|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is+ V$ B5 x" U$ K+ h* q
       Ci :integer; qi : integer' a$ s9 N. `& m* ^
do 4 [' }1 T7 j4 w9 L7 l
       inspect Ci0 f) B0 R& w  J/ V: ?
when Ci>0 and Ci <=150 then # Y0 D$ L6 e  m0 ]* W. ^
       print qi=1;. n0 U* F6 S0 k- ]% G
when Ci>151 and Ci<=500 then' I9 a2 P9 t0 n( e
       print qi=2;
* B/ z- P7 t2 a# O9 S: qwhen Ci>501 and Ci<=700 then" W0 E/ t- ~6 C
       print qi=3;
; }9 {/ B- A, f# I, W# lwhen Ci>701 and Ci<=1000 then/ N4 b: h% e3 Z* A) J: }
       print qi=4;
5 q) O6 a& {  I0 Q; T- E/ i) A7 zwhen Ci>1001 and Ci<=2000 then
9 B! Y3 h) z. V; Y       print qi=5;, |: @( E/ Q! f$ f' F/ ], r
when Ci>2000 then
; a- K' G5 R% h       print qi=6+ Q/ ], V; x& V$ L' {
end;6 p2 v' [( b" G
end;
- Y% W1 F. F2 ~2 j7 @1 ?7 V7 U  }+ m: K8 U! f
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?' v' V. ^1 j% N: U/ x5 q6 b$ m
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:* X7 ]8 M* b1 r$ G8 h
(number : integer); U8 z2 {3 }3 B0 V: @$ o) G) r1 w  g
is
+ e0 b) ~4 I2 ^9 q" f0 N1 m9 Ydo$ l$ J% k1 T' V. t% g# z# O
   inspect number
5 u8 Z- t; a! I. k/ y% N  W! C       when 1 then
/ x4 Q/ I0 h* V( p/ a. x          print "not a prime number"
' w* I- K0 }0 o7 G, w/ [5 N       when 2,5,7,3 then
0 {7 L2 P0 k# P: v0 ?( Z          print "prime number"6 m* d& O8 F; y$ n
       when 9,4 then 3 t* V5 e9 D$ h& M0 }( j/ h
          print "square number"6 g9 {+ ?- [, [
       else3 c  d4 ?1 Q" v& c/ _
          print "no special number";" p; i7 H: g  x  P, w5 C0 ?! l9 X
          print "or number greater than 9";
3 g! Y0 z/ b+ C; f0 K. l, _   end;
2 z( r, F8 T9 ~. R2 |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-12-28 14:19 , Processed in 0.012012 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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