设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7917|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
2 |; ?0 S( G) ^0 w9 H7 J0 K( k       Ci :integer; qi : integer
3 D3 S% y7 x7 b( Z1 M) hdo $ i% t3 }! z7 y$ n$ \9 U" \
       inspect Ci7 U! c0 ?" I  A! u  D
when Ci>0 and Ci <=150 then ' Z" K0 I- P6 l, x8 [% w* d7 O
       print qi=1;* Z" y6 Y  f* b! P- i: Y
when Ci>151 and Ci<=500 then, C' b' k5 `* S
       print qi=2;
( b1 |0 q& b1 A/ L0 ~. X7 Qwhen Ci>501 and Ci<=700 then
: ]1 G5 d, ]" @2 A: ~+ k       print qi=3;
' l) ^1 \! j9 V* Q" Ewhen Ci>701 and Ci<=1000 then
5 x3 i, R& @8 I, I' E. r       print qi=4;
% T) Y% }1 z3 ~0 j1 Owhen Ci>1001 and Ci<=2000 then
; f: g: Q* {3 a, n3 j) g3 D  }       print qi=5;8 H( y8 F- U8 S' _  w
when Ci>2000 then1 ~2 R4 G8 m' f0 A3 ?  @6 u+ x" S# ~
       print qi=6
$ R2 e: ~' O5 K0 Xend;
' B" O: W$ d; ?& pend;2 L+ j  i: G+ n( x. t

6 [) ?  q3 F: w+ W2 @          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
3 Y4 y1 j% U( Q3 N2 U% }$ S, k          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:" I8 t7 E8 q1 G
(number : integer)
4 k+ k( W# }8 p- Y4 R6 ^is9 p8 o7 r1 x3 C7 p
do  t, V9 G. B! u9 S0 G$ {6 ~
   inspect number& J2 B5 {3 W7 h# P9 P+ x. {4 t8 x# E
       when 1 then
; f8 w+ h% M& Y, |          print "not a prime number"
( a" W3 W/ T1 C) ]; E* i       when 2,5,7,3 then 8 D: V$ d2 j2 Y8 s7 I: i
          print "prime number"9 Z! e# u. x# Q  n# {
       when 9,4 then , S3 Z* ^# x" i3 J7 p/ R
          print "square number"7 Q; J  q4 i- z9 T) ]! ]) D1 O+ v3 g
       else
3 k4 _. m! }% k* V, d8 b          print "no special number";
; l; z& @2 x' p2 i  w- i5 `: j          print "or number greater than 9";
( Z: q+ V- U6 _& U4 x# T   end;
6 s" J- X6 B! _3 D: K! [/ Oend;
 楼主| 发表于 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-2-12 21:21 , Processed in 0.023590 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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