delphi 函数包含函数 怎么写这函数啊(50分)

  • 主题发起人 主题发起人 芙蓉弟弟
  • 开始时间 开始时间

芙蓉弟弟

Unregistered / Unconfirmed
GUEST, unregistred user!
现在有这样一段<br>begin<br>&nbsp; &nbsp; &nbsp; for i:=0 to self.ListView1.Items.Count-1 do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if self.ListView1.Items.Item.Checked=true then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get_zj:= self.ListView1.Items.SubItems[1]+','+self.ListView1.Items.SubItems[2];<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; op_update(http1,true,'123');<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>end<br>我需要写成函数 要怎么写啊 &nbsp; op_update(http1,true,'123')也是函数<br>我现在写成了<br>function seng_rw(s:string):string<br>&nbsp; function op_update(i:integer):integer<br>&nbsp; begin<br>&nbsp; end;<br>begin<br>&nbsp; result:=inttostr(op_update(http1,true,'123'));<br>end &nbsp;请高手指教
 
内嵌函数的定义和调用参数不一致啊
 
function seng_rw(s:string):string<br>&nbsp; function op_update(i:integer):integer<br>&nbsp; begin<br>&nbsp; end;<br>begin<br>&nbsp; result:=inttostr(op_update(http1,true,'123'));<br>end;<br>可以按上面的方法写,这是内部子函数<br>但也可以分外部全局函数:<br>function op_update(i:integer):integer<br>begin<br>end;<br><br>function seng_rw(s:string):string<br>begin<br>&nbsp; result:=inttostr(op_update(http1,true,'123'));<br>end;<br><br>上面两种方法都可行。
 
bbscom正解!
 
因为第1次接触delphi 不到1个月 &nbsp;现在确实看不怎么懂 &nbsp;你们能帮我说详细点吗?或者就把这段代码帮我写成函数 谢谢<br>begin<br>&nbsp; &nbsp; &nbsp; for i:=0 to self.ListView1.Items.Count-1 do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if self.ListView1.Items.Item.Checked=true then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get_zj:= self.ListView1.Items.SubItems[1]+','+self.ListView1.Items.SubItems[2];<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; op_update(http1,true,'123');<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>end<br>现在程序代码太多 ,无法进展下去 &nbsp;请高手尽快帮帮忙 谢谢
 
接受答案了.
 
后退
顶部