设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7617|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is# m# l5 p: ?& u; G" l+ u% P7 l2 y
       Ci :integer; qi : integer
7 w/ J5 ?0 a* q; g7 K# n% Tdo
, S/ z3 g9 B& J" k; @) s0 F9 w       inspect Ci
( x- D) m- V" J& e6 M* b- xwhen Ci>0 and Ci <=150 then " @* r8 F- d7 [* {
       print qi=1;1 t  _2 g& V5 n5 S
when Ci>151 and Ci<=500 then
" b/ d+ G: u$ w       print qi=2;" ~4 ?9 R- o" {+ Y
when Ci>501 and Ci<=700 then
2 @, r/ z0 ]9 o$ P# E9 J       print qi=3;
; q9 E* x: E: s% Owhen Ci>701 and Ci<=1000 then
. J/ ]6 F9 f2 H) z       print qi=4;
/ c( k% X! N3 V+ e5 ywhen Ci>1001 and Ci<=2000 then) F1 \0 z0 L: [' N2 t. u) y+ Q
       print qi=5;4 ]# L% p& z! u: I  m3 Y3 O, {
when Ci>2000 then
& D; f) a& Y1 W( [       print qi=6
/ z$ {( q4 R+ k- mend;
' d% K4 Q3 K4 M1 ~0 wend;
$ z6 T  E2 X5 ^4 a& W2 k) D$ p4 W$ d/ X. B1 O: g+ O, x3 i! I
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
4 Y8 {1 G4 ?( \* g8 o          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:3 Y' Q2 ?% R" S  y& n+ v, w+ `
(number : integer)
5 ?0 ^$ u% v; H$ X0 C0 O: B! l% fis/ t; U& A. H5 `' `) N' e
do
6 C; \0 q" @: t9 U" b   inspect number
& I6 }. w/ s7 b       when 1 then ; T* j4 @) }9 g
          print "not a prime number"
! x0 U1 Y  Q5 n; E8 m( R2 f/ ^       when 2,5,7,3 then
4 H8 L3 v: H: r* O" U. J          print "prime number"
; z, a( s- n' G" p" |. f9 V+ B       when 9,4 then
5 p/ ]6 ^3 z; f5 |2 A$ S; A  j          print "square number"3 M! Z" P3 M, D  c6 a+ X. _' L
       else
2 x7 s7 B% Q. C* ?6 ~  }3 p: e          print "no special number";
; K) b8 r; k) ^2 G/ t$ k1 _          print "or number greater than 9";
9 M3 [6 G: |3 v9 W% n* A1 U   end;
0 Z7 T1 D  {, e3 x  P. L7 |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-18 14:09 , Processed in 0.015403 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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