设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9425|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is6 t$ O5 \) w0 m. @% e
       Ci :integer; qi : integer
- [) L: F* f  j% V9 Ydo 7 e+ x; q9 d; S. b1 T6 s
       inspect Ci3 j# i! ?8 U6 Y
when Ci>0 and Ci <=150 then % B9 }9 P0 B, ?9 h
       print qi=1;; J: u# J% p1 f  B4 S! x0 c
when Ci>151 and Ci<=500 then, h5 Y/ k4 J" l% x* A
       print qi=2;* R7 R- _& {  ]2 n* Y& n4 l
when Ci>501 and Ci<=700 then
/ b# x. w3 \( A. V7 M0 a9 d! Z- }       print qi=3;4 n" P% {6 T& p% z. V
when Ci>701 and Ci<=1000 then
9 Y7 [8 y4 @, D3 w, Z       print qi=4;5 P, `, n% E6 f9 u4 X# F: f+ f
when Ci>1001 and Ci<=2000 then5 `# H% P/ d# H" p; t6 H3 |% y
       print qi=5;
. s7 ]3 w" B  B) m6 y* ~1 A! \when Ci>2000 then
( {4 n+ p% k( D3 ]& X" ?- I+ M- L6 j       print qi=6
9 r2 r. k* L5 O9 xend;
. D1 T3 X. X, d' Y" Iend;1 O: `* M- _: A* g  j3 c! d5 |1 U5 \  {

1 @- e8 F3 y( _! D0 l2 s" \          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
* A' j, A3 j" I8 X  ]9 z          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
! O* p/ S. m  f2 h$ i9 v5 g(number : integer)
! ^0 W3 j) e% p. I: N5 uis
: |$ s. c; ^* w6 `6 G: Bdo& j$ |% W, K8 F. ^: y+ d
   inspect number
: q/ R% ]8 v+ }3 X# \* z5 c% @( o9 o       when 1 then
6 b, I" f/ f$ B          print "not a prime number"
* c! p3 z; K! w( x7 s       when 2,5,7,3 then - }# p  P" s# `6 @- n, Q
          print "prime number"% D5 B! P% X  Y+ G/ F
       when 9,4 then
: w; m: F- m- v4 b+ m. }          print "square number"
. N' w% B+ _9 E: @3 T; B4 G       else5 V+ j  a. J# c+ @4 M
          print "no special number";
& L4 `1 Q' k& B0 e* T; u9 x/ c          print "or number greater than 9";7 i1 G9 V4 ~0 M; [9 i' A
   end;
' `  V4 O/ e; |# L% [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-9-16 10:53 , Processed in 0.015341 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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