设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8868|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
+ k( {/ o  n/ g" @7 Q) `       Ci :integer; qi : integer
  A3 T3 x' U4 ?! G* {# i) f  sdo
0 |0 H  s6 b, w3 C$ Q5 H0 r4 H5 X       inspect Ci
4 s/ b- A( j" [$ [' Iwhen Ci>0 and Ci <=150 then
* A4 {/ l# }) M       print qi=1;
1 S' _* H3 Q3 W+ {+ x( v+ O+ Gwhen Ci>151 and Ci<=500 then
5 u2 B1 V$ f, j' @7 M6 {       print qi=2;
$ k" ?8 `  G  {( H  |3 ?. [( G1 Ewhen Ci>501 and Ci<=700 then
) ~# o  m3 A8 ]9 Y" C  i  D6 r       print qi=3;. f8 z, P/ Z$ w! A" V, V
when Ci>701 and Ci<=1000 then
+ g% X7 e) Z+ P& [; O       print qi=4;
% x3 ]3 Z) h  v: Q9 v( i3 Gwhen Ci>1001 and Ci<=2000 then$ L7 i, T! a8 |* }
       print qi=5;
4 k, X1 c& n7 V2 }when Ci>2000 then% U8 W0 J0 ?- i2 ]
       print qi=6
! s1 w9 Z: F/ X* e8 O2 c1 L$ lend;
- `0 ]$ m" l$ e2 g2 Q6 Q2 k* Jend;
6 W" N" [! {  y! Q* m! _8 V5 b3 Q$ f# B- s& X8 y
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
" |5 }" K; }7 M4 h7 Z. f, a5 I          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:* y/ r* g8 d& a) x: f% p$ f& U, l
(number : integer)
$ c: C) A* S8 f0 Pis6 b9 |/ z8 [$ [4 V! T$ b
do
+ i# r  C& i3 e% _- Z7 Q+ t   inspect number
6 v* l& L7 Q+ Z: p4 J- O       when 1 then 6 z5 Q/ U5 U3 ]" [, e
          print "not a prime number"
& R& q( _! G8 p. V       when 2,5,7,3 then
# Y  g' B, Z6 [: M6 v          print "prime number"1 D* }$ m1 J9 E5 D9 j
       when 9,4 then . Y  g1 D3 Z" {1 e) S, _
          print "square number"
2 K' O2 {" F; e; g. m5 {2 N       else
! E# V# V" m, J# j          print "no special number";2 a3 {- c: }( l9 L8 P
          print "or number greater than 9";! ~- N  c  d( X; w$ q. e
   end;
- p; W+ K3 ~/ b3 A2 Q7 v) nend;
 楼主| 发表于 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-7-11 18:29 , Processed in 0.015189 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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