设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9014|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
+ v. ]& ?- X" w  X0 W0 _3 D9 J       Ci :integer; qi : integer
6 y3 a; L) [" W) }. q# i" u5 pdo ( E+ ~1 T# C- \! X' c# }- T+ w
       inspect Ci
9 L+ M$ Y; G: }; F3 V) `) L9 l* Swhen Ci>0 and Ci <=150 then . b& e4 o# o( O6 j7 `
       print qi=1;
3 H2 P0 {7 G6 S0 g2 ~8 T4 V4 Y; ~when Ci>151 and Ci<=500 then& H% V$ Y) p* X, |
       print qi=2;
* J& W& q% L+ q* Iwhen Ci>501 and Ci<=700 then
: \, m6 `3 m. N! _+ d7 }  t, }       print qi=3;
, K0 K5 m: l6 a- A: I# z/ d7 u: [when Ci>701 and Ci<=1000 then
* Q9 Z' Y. w* Z  J1 A       print qi=4;
6 Z- z. h) E* t% D% bwhen Ci>1001 and Ci<=2000 then9 c: B& F# |* S; d
       print qi=5;
& k' H4 r( ?( s# ]4 A6 z, U5 awhen Ci>2000 then) V/ |' R! b* T! G9 Q' ^2 @5 M
       print qi=6& m$ ]5 u2 T5 R" j9 e
end;
4 g" f' [3 P8 A' n: [end;8 c" N! ~, b! R

& G- @2 o9 r9 Q4 x          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
$ r1 A* G9 O, W7 C          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:. @0 }4 Z. r' }2 j* z5 K
(number : integer)- [% n) r0 X' `) ?1 C2 @4 q9 B
is
5 S3 q% ]% R3 Y5 \! W/ Wdo- f# c3 Z) ]. R: Q$ \- m
   inspect number7 j9 R2 H0 K( H( z5 }' E/ n: X5 K" Y
       when 1 then
$ S/ w/ `0 g) Q. f4 f          print "not a prime number"
3 f% C! L3 f2 Y$ |! W' p0 h       when 2,5,7,3 then ( ?( G/ {+ \( o
          print "prime number"# ^; Q5 k. F+ E* w
       when 9,4 then
. N$ J6 e" S/ R5 I  O          print "square number"0 i! f- Y! a) h! X  l: ^7 g
       else& S+ n4 b" l) o/ }
          print "no special number";
1 ^/ |0 e/ g( f% y" A  b& I0 m4 {7 f          print "or number greater than 9";1 m: J9 v5 f4 }- W5 T0 p+ m. n
   end;) b, r5 \% H3 v' h% b/ w- }
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-22 00:40 , Processed in 0.012135 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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