设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8102|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is% q) f; m( D/ b+ N" _
       Ci :integer; qi : integer
2 q% i! Q1 W( I( u) m+ U& _do
- |4 N  m+ Y0 g* B$ K6 N9 u       inspect Ci$ W9 w& d5 O, \0 y
when Ci>0 and Ci <=150 then
; J, B+ Y6 e; o* d* n, F0 r       print qi=1;7 h, t; C9 R9 k0 E) I/ e
when Ci>151 and Ci<=500 then; l- G2 w, s1 p  @0 }% j% l3 ?6 M2 q
       print qi=2;
  l. B% u5 T; l5 Bwhen Ci>501 and Ci<=700 then
! G4 [3 ^) C# V3 R  e  @, A7 s       print qi=3;5 {2 `* ^1 C- `& n( f
when Ci>701 and Ci<=1000 then
( g' H3 s6 T" L) l* @* S       print qi=4;" ?  q" v& w; r& z4 H% W
when Ci>1001 and Ci<=2000 then# o) O2 b$ P  x3 p! j
       print qi=5;2 f# P* n0 e* z) l+ v" Y8 ?
when Ci>2000 then5 B6 K, o2 L; P7 b" W; F
       print qi=6
) U: Z, q& a  r" u% U! y5 i& h( Tend;
- e* {) `+ `$ g8 H* ^end;; G3 A1 \: a& m9 z
" m* R9 r/ M  z7 ?4 k4 i: p7 Y4 Z
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
0 p- L/ u4 `+ `9 M8 z# d          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
" F: J6 I* o% V; }0 r' ](number : integer)
/ z' Q& i! H  u% l' s, gis7 `! i; P' O0 m* a% \& B7 k
do
! v' R/ b6 r7 S" w/ n5 F" w   inspect number
5 v- k$ y; M2 w9 I7 i& X. _  I       when 1 then
$ j2 X1 S4 c1 b          print "not a prime number"
& v' k; K/ T) W" `* S       when 2,5,7,3 then
- T* _( G( l; x1 h$ d& x2 W# K          print "prime number"
+ b, |4 |$ C2 n; T) ?9 B8 d/ E( U       when 9,4 then 7 A# n9 L* V, D6 J+ v
          print "square number"
, k* y: q$ _7 G       else: G' |( v2 F% |: w& ~9 Z5 G% q
          print "no special number";
! u9 W" u: W! m! O3 }          print "or number greater than 9";# n" z, G! H) a6 {
   end;
) `( Q3 M7 H  y$ a$ X0 Send;
 楼主| 发表于 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-3-20 23:13 , Processed in 0.013432 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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