设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8707|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is
5 A  o& G3 D4 Q; m' X# Q! h5 ^- ~       Ci :integer; qi : integer0 o. [4 i  j( e
do - t! L! G/ u. M' D  F8 |# N
       inspect Ci
0 o6 c6 C4 _. }. T" s6 e, g" Fwhen Ci>0 and Ci <=150 then # q4 s+ E. q1 x5 X$ q% [
       print qi=1;
: D- N- h4 J% Z, q- A$ h' fwhen Ci>151 and Ci<=500 then# D! r3 S: l0 J. S$ n8 v4 A
       print qi=2;
! N5 i, r: S$ S) h" x1 }3 B1 s% kwhen Ci>501 and Ci<=700 then  O" A; n  Z3 y1 t
       print qi=3;1 f7 T  X5 ]% H
when Ci>701 and Ci<=1000 then
( V, x7 a. _1 ]# O6 T, y, s0 @       print qi=4;+ n7 k1 a0 u* a/ G: \# x( I, b
when Ci>1001 and Ci<=2000 then
5 M" o& I# |; V7 |1 ^       print qi=5;
( ~# X. d* l7 ^8 A8 q) iwhen Ci>2000 then' A' m" \& m  w5 m' w+ }
       print qi=6
& m2 P' W$ S7 l) {. N! P1 Aend;
. N. _" N  H! b; [! Z- d& qend;8 h8 {! f2 R! [2 m
% J7 ^6 N: B' N; E
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?9 f7 @4 x7 j7 t( J& k3 W
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
& V- Y- C4 i. s  n  @(number : integer)
, W2 K" m1 }2 _6 |4 lis5 r) K' S, M+ m8 a! J* W
do% p1 n0 e9 s! m) ~9 M  b0 a7 s6 @
   inspect number
1 m, [8 S" P$ V0 x" i0 o8 Z       when 1 then ; M  J+ B; d3 G3 a
          print "not a prime number"
  @7 M0 j# T) a+ W. p) G       when 2,5,7,3 then 8 V% ~6 e/ c# z
          print "prime number"
4 N. w$ P9 h' b- e/ M       when 9,4 then
, e) H! A% R- f          print "square number"! Y! V- J; E! C" Z6 o$ h
       else9 V0 _6 k3 b2 }5 N0 w% k
          print "no special number";
2 N# E# M: P  m* ~1 \          print "or number greater than 9";* Q4 Z; ^* U. c+ r
   end;' F- ?2 y% P% E4 g. @& y1 x
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-13 05:18 , Processed in 0.011493 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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