设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8757|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is9 f$ y  y) Y2 Q. }1 J9 p2 N! ^  L
       Ci :integer; qi : integer
# G3 ?) ?& W/ R6 Edo 0 b  m; o3 b' U8 u. B
       inspect Ci1 ^# _. b5 g3 _" C
when Ci>0 and Ci <=150 then
, ]0 p5 P, G6 C" k! j       print qi=1;3 q3 m/ I8 ^# x! `$ Y
when Ci>151 and Ci<=500 then
, S' h: _  b6 H* r       print qi=2;4 M: U( f8 K5 D2 |+ d' M
when Ci>501 and Ci<=700 then
$ U2 r' A, J" B6 m3 ?  T       print qi=3;
6 u/ q* E/ W) y% C9 Y: zwhen Ci>701 and Ci<=1000 then
. @# ?5 X8 }0 N) {! ^5 q! y/ q7 G       print qi=4;
5 H3 i7 V# y$ l$ `4 x% @. ~: u, Qwhen Ci>1001 and Ci<=2000 then
% {& _8 Q6 X' X  c; @6 ]* h       print qi=5;  g/ U/ W' N6 |6 ~8 ~
when Ci>2000 then
% D2 C6 [  n) U2 n4 e- N: N       print qi=6
; w, s$ X' r$ Q/ [: Zend;  G4 N8 z5 m7 s' m( A  A
end;8 m8 a9 Z% m- ~: q5 S
1 K' P4 u9 D( u7 x; F& q, {( {
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
7 ^% y" A  ]0 [5 _3 N          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
9 k/ Q3 y  H, K7 X5 k8 Y(number : integer)
# x7 o% `; v2 xis
9 ]+ ?: K3 Z8 qdo
' N- C9 u: [- V- Z   inspect number8 M* L# o4 e* [9 |
       when 1 then , X2 X$ a( a5 z* [  S0 K/ {
          print "not a prime number"
5 e" J3 v, j" A* f" W" E       when 2,5,7,3 then
0 x, g3 i; `' Z( {0 y6 |# [2 l          print "prime number"
; ?% U+ U4 z) q% Y       when 9,4 then ' l9 I) T9 j* l  i" m4 d, j3 }
          print "square number"
) Y0 }% ^$ c. B& c. D3 J       else' p; z, j1 J6 B0 p1 T6 b% M
          print "no special number";; a6 q* t; N" \7 E( X5 i
          print "or number greater than 9";  y( G$ c' o8 ?/ D6 }# Q
   end;) G3 Y6 x( d0 Z+ v8 p
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-6-23 08:22 , Processed in 0.013007 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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