题目:编写函数fun,函数的功能是:求从m到n的乘积并显示, '如:m为2,n为4时,显示"24" '存储连乘的乘积

题目:编写函数fun,函数的功能是:求从m到n的乘积并显示, '如:m为2,n为4时,显示"24" '存储连乘的乘积
题目:编写函数fun,函数的功能是:求从m到n的乘积并显示,
'如:m为2,n为4时,显示"24"
'存储连乘的乘积的变量必须为Product
'要求使用Do While...Loop语句来实现.
'-------------------------------------------------
'注意: 请在指定的事件内编写代码
' 代码只能写在两行标识之间
' 不得修改已有代码
'保存时不得修改窗体和工程文件的名称及路径,否则后果自负.
'-------------------------------------------------
Private Function fun(m As Integer, n As Integer) As Long
Dim Product As Double, t As Integer
If m > n Then t = m: m = n: n = t
'
End Function
Private Sub Form_Load()
Show
Print fun(4, 2)
NJIT_VB
End Sub
Private Sub NJIT_VB()
Dim i As Integer
Dim a(10) As String
Dim fIn As Integer
Dim fOut As Integer
fIn = FreeFile
Open App.Path & "\in.dat" For Input As #fIn
fOut = FreeFile
Open App.Path & "\out.dat" For Output As #fOut
For i = 1 To 10 Step 2
Line Input #fIn, a(i)
Line Input #fIn, a(i + 1)
Print #fOut, Trim(Str(fun(Val(a(i)), Val(a(i + 1)))))
Next
Close #fIn
Close #fOut
End Sub
其他人气:881 ℃时间:2019-11-22 14:56:34
优质解答
fun=1
t=m
do while t
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版