设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8386|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
9 a8 f" j5 R" U. u0 w; X       Ci :integer; qi : integer1 Q1 U; ^: U7 U! Y0 _! B
do
( _) }' t# k! P5 o" d  q7 W( C       inspect Ci
2 A* U, z9 O4 e8 y: wwhen Ci>0 and Ci <=150 then
2 f* N1 G2 L' Q' s       print qi=1;8 z8 i% E6 j$ ~5 D
when Ci>151 and Ci<=500 then' a! S+ m8 v) ]' ]+ H& A  j
       print qi=2;6 s; w# W1 g& D
when Ci>501 and Ci<=700 then
# J3 U6 W& E3 ^' o6 z) i, {4 H7 [6 `       print qi=3;
4 ]! H2 S$ I% Q; b& ?when Ci>701 and Ci<=1000 then
6 ]. A8 l# u% T, ^2 o       print qi=4;6 T' V3 M" g8 T9 F7 T' k5 X, v
when Ci>1001 and Ci<=2000 then
3 {7 {0 U& f3 l' x1 k3 a; B' E       print qi=5;4 _" U+ e" o& h4 e% i$ M: E* E
when Ci>2000 then
4 s, h7 a7 h) u8 B       print qi=6
& i) D6 z: J: {! ~+ Gend;
2 K1 Y: f) a3 v* G; K/ Q) `7 h/ j  hend;
0 `0 M8 G( H& r- g
& Z: G: A8 {# P% M6 M9 V, {  A          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?7 H, {5 P( H6 M: R! `
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:4 Q8 \4 p1 C* r. e1 w
(number : integer)) }* f5 P0 ^7 {9 T5 H; Y
is. x  \# S. s+ N/ s% E
do2 H1 d  U( N% C' A# W  L! l9 z! |
   inspect number
) H* `5 b; |% E9 O6 W       when 1 then
6 h, G0 T$ r0 {2 }1 A3 \1 K          print "not a prime number"5 K+ Y! c8 Y% X8 O) F
       when 2,5,7,3 then
' x$ C; X' d: W) ?: U# f          print "prime number"8 u; V  @9 e% h
       when 9,4 then   u8 [" \6 A. V3 e2 F# N
          print "square number": }0 Z3 p4 g+ V
       else
! o- z1 y9 o& x5 ~          print "no special number";" U1 c- h2 J  ^
          print "or number greater than 9";; |3 r" y. w$ x) J6 W% d/ t
   end;
/ `, g4 M0 ~( l& W1 vend;
 楼主| 发表于 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-22 14:35 , Processed in 0.017477 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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