设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9041|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is1 R( D! j6 D1 W
       Ci :integer; qi : integer0 h5 o: K$ A, g0 G
do
5 h$ X- \5 T/ \, w% @* t+ {       inspect Ci
% l+ E; ]5 _* w4 B- {* ywhen Ci>0 and Ci <=150 then
9 Y+ g/ D  C) _7 E       print qi=1;
$ g0 m; h+ d% ~% {3 V. ?+ \4 L- B( `when Ci>151 and Ci<=500 then+ K# L3 q, e8 e$ O
       print qi=2;
3 U9 m5 {1 e' c+ V7 D) ewhen Ci>501 and Ci<=700 then! F6 M0 I7 N7 K9 {+ M+ B
       print qi=3;
3 U: Q6 A0 G& F5 @* Dwhen Ci>701 and Ci<=1000 then
5 B0 b0 y0 X8 S3 ?       print qi=4;
$ _8 H# d, Q" m- ~+ p/ Vwhen Ci>1001 and Ci<=2000 then% j' l9 Y  f' |; k5 s# [3 m- M  x
       print qi=5;" N/ O) W: z1 A+ J# s1 V
when Ci>2000 then
- n- h9 K) a/ T! k) f" Q# {       print qi=6% _! d/ v) A0 Z6 S
end;
2 ]" i- X" i1 ~1 W; D0 t$ Oend;
/ [8 c8 h6 P; e3 G: S" ?( o6 N7 x
+ B& J5 h4 \4 A' o          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
1 D  _- Q2 h/ j9 V/ t# e8 @          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
' E, [0 P% x0 K: o(number : integer)
9 `8 T: j; ~# R/ d; o: P8 gis3 L, r2 r" C9 |! t' B  F
do8 }# j& q5 q1 J4 V! R+ u7 o
   inspect number
% z3 r8 r" J& a       when 1 then " _4 a- B+ {7 m- f
          print "not a prime number"+ S6 Q7 b6 }" u( V
       when 2,5,7,3 then / B5 R6 x) h2 i: U
          print "prime number"/ B5 X3 k' b' G7 ?- K3 i
       when 9,4 then # Z+ Z4 m5 Y) y2 d& [
          print "square number"
  K, r4 ]( m& D. `9 M       else
7 i1 \) _$ Z, y8 u+ f# I8 j0 h; N          print "no special number";
+ u* S4 g5 M7 j6 B4 t4 Y1 h          print "or number greater than 9";
5 _- ^0 b+ Y* B5 N/ F+ P   end;" a! [, h/ p4 O& }4 d  H. E( |
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-7-24 18:54 , Processed in 0.012862 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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