设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9243|回复: 5

[求助] Inspect 编程问题

  [复制链接]
发表于 2009-5-12 20:16:59 | 显示全部楼层 |阅读模式
5仿真币
is2 M* |# X5 q; b4 t1 n2 a
       Ci :integer; qi : integer
" s& t4 J! o$ R6 e; u4 j4 Mdo ( n5 b9 {9 D3 ?: w8 B% [5 e
       inspect Ci. t9 G" ^) }2 H) J9 e/ `
when Ci>0 and Ci <=150 then
2 I* G. n4 L6 U' r$ X' U8 D       print qi=1;
6 L% e3 V2 X1 owhen Ci>151 and Ci<=500 then
4 e8 y% N7 s. T/ K, {% \. {& U) I7 J       print qi=2;
( a$ E  y, M/ Jwhen Ci>501 and Ci<=700 then
, M+ i- H# _4 |  I       print qi=3;) K! `+ p* Y) p% o
when Ci>701 and Ci<=1000 then
2 P* h+ w+ _" ^4 `       print qi=4;" N6 \1 T* b' |
when Ci>1001 and Ci<=2000 then
% o9 h: b5 C" ?5 x, x2 M6 @       print qi=5;. Z- f. C7 O9 y( l
when Ci>2000 then$ {) s7 [/ a0 h; |
       print qi=6
: i$ X& m: \$ d. Send;
, H3 S4 \1 `4 U# uend;6 C) Z  I6 n3 |+ h6 D# @
9 X7 h; d2 M  N, W; E( r, s7 A& ?4 o0 _
          运行提示line 5附近的Ci 句法错误,想请教一下各位高手!如何解决?
% U+ \3 [; Y, n  T$ q; ]. P% X          谢谢!

发表于 2009-5-12 23:36:09 | 显示全部楼层
inspect应该不是这么用的,不知道你要解决什么问题,如果是要本程序内判断ci的大小,用if-else就可以了。如果ci不是本程序的,需要调用此程序时,可以用inspect,用法如下:; Q0 a: a& Z6 w9 b1 }
(number : integer)
% L5 t5 |9 `" j. eis5 X1 M6 M" h* l) m+ B- B5 A
do& O- v% B, d$ g* H
   inspect number! A: `" ]1 I6 g1 r+ Z9 u. E
       when 1 then
9 h, E: O" p) l+ E3 F          print "not a prime number"0 P1 Z: U% }/ {$ ~8 |/ w# ~
       when 2,5,7,3 then 8 `+ B  z( V( g
          print "prime number"5 D$ T8 O9 V- |7 u9 _
       when 9,4 then
! h# b6 e! Z) M) J+ L  L          print "square number"* u5 U! ]! b' S$ u& |  @9 x
       else6 f, a7 O8 W9 S
          print "no special number";! L8 C  U2 u  H. K2 L
          print "or number greater than 9";
$ P9 w. E5 G/ e/ \0 w! N   end;
+ Z9 e8 }4 g. u& X0 M, pend;
 楼主| 发表于 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-8-17 14:58 , Processed in 0.013189 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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