设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7906|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
# j; P. y9 `( h       Ci :integer; qi : integer. q' {2 r- ]: C4 P
do
5 |$ y0 [4 b% ]8 o. h4 Y       inspect Ci  D4 F; C& T1 n/ h7 b/ A5 @
when Ci>0 and Ci <=150 then 6 Z6 w8 u+ a" [& M
       print qi=1;
0 n4 E' j6 ], K  X. r* o% R6 E9 p! H# uwhen Ci>151 and Ci<=500 then1 A9 f& w# w6 @$ e5 G( U2 M# s1 C
       print qi=2;
1 S' H  ^7 M- D* F2 u1 K  Ywhen Ci>501 and Ci<=700 then
6 w4 i; K+ Z" @. K       print qi=3;
+ b" k% r! x6 o3 t9 A2 |: `5 Jwhen Ci>701 and Ci<=1000 then
7 Z6 G5 _) `' ]       print qi=4;/ m) r! p4 u8 y
when Ci>1001 and Ci<=2000 then
$ \, E6 c; f* S5 t  y; v/ v, G3 l/ r       print qi=5;
+ \, r$ H" m% \when Ci>2000 then. y" G5 {- X, X* C) ]5 A1 M3 z" |
       print qi=6
/ g% g7 V+ r$ w  u! G% G& mend;
2 i% I0 y) f6 y: ^% z) g' Y# fend;
  }8 o9 c0 ^2 \( v' Q- P9 Y6 Y( q: u/ P" y5 n' Y# L
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
) W' X4 C! `  n' ~  O3 E; {          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:. `0 C1 W( Q2 Y9 Q& }" Z
(number : integer)
8 P) f6 D& Z+ N# \$ c" `2 O7 x) Nis8 D, y$ i# j; a% |9 w: t1 Z
do
- @. S8 f" f8 L4 J   inspect number) c& ?7 y4 Z/ O" q3 H1 |
       when 1 then - S! n* D4 H) ?' `% L
          print "not a prime number"
# r% ^1 d. P; p       when 2,5,7,3 then
2 f" d( o7 \" q/ x6 c% s& T          print "prime number"" W9 n5 B/ Q  [* r# L# k
       when 9,4 then . O, m8 ~7 F3 M  f; U, M7 e
          print "square number"
. n  ]& e) ~. y0 L$ B       else
6 r8 j& J9 k7 Z1 h- C0 v; C. C1 O          print "no special number";
7 n4 s7 ?  O# V5 y' c* p7 M( ]0 i          print "or number greater than 9";
+ c6 K. K# p, U* {/ b( I2 [/ W# j3 L   end;) V# b. l) C$ `
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, 2026-2-10 17:27 , Processed in 0.017177 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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