设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8097|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is  T; I  _2 T4 V
       Ci :integer; qi : integer
' X! x2 H- x8 @; ^$ ?do
% g" ]; w* F- w4 Z% W+ @) i       inspect Ci
% |" Y4 n) s5 Twhen Ci>0 and Ci <=150 then
9 O% m4 g% N8 W7 Q: O       print qi=1;
8 ]& y0 X# [+ l) R+ F) b; Dwhen Ci>151 and Ci<=500 then. U) F+ }. B" O
       print qi=2;
" ~/ z! o) @8 y3 Uwhen Ci>501 and Ci<=700 then2 G+ H5 c+ g9 x0 {$ l3 q' O
       print qi=3;* X9 ^0 k# i6 e- f; y7 f( F
when Ci>701 and Ci<=1000 then
0 w; w/ T7 f5 d' d       print qi=4;
: i1 r* X  F( b( K( Dwhen Ci>1001 and Ci<=2000 then9 h7 W  b* O2 o& r$ N
       print qi=5;
  j# d( y) Z$ i$ V# fwhen Ci>2000 then
6 x( H! c2 b8 h; o8 U       print qi=6% J8 a/ W8 y( i+ x3 S6 l
end;+ p3 p, E: B3 N/ H5 j+ V
end;
# D% V& [- v5 m5 c/ |  c- _1 d( {* [# Y- q" P' z" _
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
4 X  {2 V& @! ?+ P          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:; S% S1 |5 c) x6 N( I% U( \
(number : integer)" h8 y9 n, N8 R$ H& o' g. w
is) K) R5 S5 @6 Q) f4 ~
do
+ U  \* j: n6 d: @! t! |8 Q8 Z   inspect number
  b& z8 {, k5 ]/ ?, {       when 1 then 3 I& b: s$ ]$ d& S! x+ H
          print "not a prime number"
% N3 n% l& G! t8 J  E2 o7 \. c       when 2,5,7,3 then 5 O; _) u8 q6 z+ B9 f6 l6 |4 F( z
          print "prime number". o" o! p! B* d) y4 `
       when 9,4 then * D  k. F6 L9 P  Q1 `, t
          print "square number"
; n$ V, _" h& F+ d8 a+ V( o) j" N4 M       else
$ O+ N8 U, M: X& P, e' u          print "no special number";  C9 E% ^/ B4 v+ B* z
          print "or number greater than 9";
; s* T, r- w& P  k$ |; C   end;
+ R: |( H2 x5 E1 Y9 x( k. hend;
 楼主| 发表于 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-19 18:02 , Processed in 0.015038 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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