设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8727|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is/ |/ h9 J$ W+ y+ r: R, ?
       Ci :integer; qi : integer
: k1 g% v* G( W: ^do ' ^) m, o8 d/ \4 H* d# O
       inspect Ci9 g$ L9 A9 y& M2 e2 G( A* H
when Ci>0 and Ci <=150 then ) o# k1 V0 ?1 O" D  _6 k* s
       print qi=1;
7 Q" _& T2 Q& C$ i0 A8 \2 r: _1 n: |when Ci>151 and Ci<=500 then$ g' c- B3 A7 |0 u( _
       print qi=2;7 T, d- m* e* I2 z9 t1 X* g2 O
when Ci>501 and Ci<=700 then! [1 z+ J- x& h" o
       print qi=3;$ l! j1 q" o  M
when Ci>701 and Ci<=1000 then
- `* S; c8 m  ~9 u       print qi=4;5 p$ f/ @6 {' c6 Z4 J
when Ci>1001 and Ci<=2000 then2 ~5 }2 ]) s& Z
       print qi=5;7 s8 ], ^' i: v: k  O4 ]0 P
when Ci>2000 then8 l6 _- a+ U6 h( [, d, |; t# S+ Q9 s
       print qi=6- N! {9 r; F. L$ B9 S* d) `
end;
( f) m" R0 [1 P' c% ]( @, T. iend;
( h1 v& H: X+ P9 i/ p: d: [
; x8 O0 B! k6 X4 K8 t( R2 D5 b: _          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?4 f* |! {1 P% a" v* B9 H1 d2 v0 C
          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:
, j' q) Z- P& U" G# }0 g- d(number : integer)
  J& G2 K/ x5 U, ois
6 s, W5 n/ U! Q. H9 e/ w/ T8 k3 {do9 i/ j9 Z: U( m( K$ c  m
   inspect number
! a5 z- F' A) [* M7 A       when 1 then ' E, t6 g$ `* I! C6 G; A
          print "not a prime number"! d) E: E" `/ q6 v& c
       when 2,5,7,3 then
* k1 h& H! i* e# p4 {          print "prime number"" @$ [, O$ E& E& B( u
       when 9,4 then
7 `3 |2 W$ T- n# p0 R, s  A          print "square number"' l; h6 P  [6 X! |
       else" h0 F9 l% P* i& ^4 v9 q$ W- c
          print "no special number";7 X9 t* j0 w0 q. [( T9 }
          print "or number greater than 9";
$ [4 k# K$ k  H$ W; }   end;
/ s7 w+ R5 X' u6 m, Q  Cend;
 楼主| 发表于 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-17 02:01 , Processed in 0.013772 second(s), 12 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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