| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 509 人关注过本帖
标题:[求助]怎么返回不了的呢???
只看楼主 加入收藏
nanmin213
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-6-4
收藏
 问题点数:0 回复次数:5 
[求助]怎么返回不了的呢???

Public Sub n(x As Double)
Dim sum As Double
sum = 1
For i = 1 To x
sum = i * sum
n = sum
Next i
End Sub
Public Sub m(y As Double)
Dim sum1 As Double
sum1 = 1
For j = 1 To y
sum1 = j * sum1
m = sum1
Next j
End Sub
Private Sub Command1_Click()
Dim a As Double
Dim b As Double
Dim c As Double
a = Text2.Text
b = Text3.Text
Call n(a)
Call m(b)
c = m(b) + n(a)
Text1.Text = c
End sub

要怎样返回 n 和 m
请教各位高手

2006-11-08 10:22
youhm
Rank: 1
等 级:新手上路
帖 子:86
专家分:0
注 册:2006-5-25
收藏
得分:0 
你定义的是过程,改成函数
2006-11-08 12:23
nanmin213
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-6-4
收藏
得分:0 
Call n(a)
Call m(b)
c = m(b) + n(a)

n=n(a)
m=m(a)
这样吗????
2006-11-08 14:58
jcj820303
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-11-8
收藏
得分:0 
Public Function n(x As Double) As Long
Dim sum As Double
sum = 1
For i = 1 To x
sum = i * sum
n = sum
Next i
End Function
Public Function m(y As Double) As Long
Dim sum1 As Double
sum1 = 1
For j = 1 To y
sum1 = j * sum1
m = sum1
Next j
End Function
Private Sub Command1_Click()
Dim a As Double
Dim b As Double
Dim c As Double
a = Text2.Text
b = Text3.Text
Call n(a)
Call m(b)
c = m(b) + n(a)
Text1.Text = c
End Sub
2006-11-08 15:34
nanmin213
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-6-4
收藏
得分:0 


终于明白了
谢了
一直都搞错了。。。。
我真菜啊!

2006-11-08 15:46
sillygirl
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2006-10-30
收藏
得分:0 
以下是引用jcj820303在2006-11-8 15:34:42的发言:
Public Function n(x As Double) As Long
Dim sum As Double
sum = 1
For i = 1 To x
sum = i * sum
n = sum
Next i
End Function
Public Function m(y As Double) As Long
Dim sum1 As Double
sum1 = 1
For j = 1 To y
sum1 = j * sum1
m = sum1
Next j
End Function
Private Sub Command1_Click()
Dim a As Double
Dim b As Double
Dim c As Double
a = Text2.Text
b = Text3.Text
Call n(a)
Call m(b)

c = m(b) + n(a)
Text1.Text = c
End Sub

jcj820303朋友:

下面这这两条语句是否多余????
Call n(a)
Call m(b)


2006-11-08 22:09
快速回复:[求助]怎么返回不了的呢???
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.053334 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved