题目:编写函数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
人气:327 ℃ 时间:2019-11-22 14:56:34
解答
fun=1
t=m
do while t
推荐
- 求25个0.4,12个0.5,24个 2.5,11个2连乘的乘积 急用!
- 编写保留两位小数的fun函数
- 求25个0.4 12个0.5 24个2.5 11个2连乘的乘积
- 用递归的方法实现fun函数的定义 :m,n均为正整数 fun (0,n)=n+1; fun (m,0)=m+1; fun (m,n)= fun (m-1,n)
- 请编写函数fun,其功能是判断一个整数n是否为素数,如果是素数,则返回1,否则返回0.
- question:今年春节××和父母去长江三峡游玩,回来时坐江轮顺流而下直到上海,在途中有一个问题让他百思不得其解:每到一个地方,轮船在码头靠岸处都要来个180度转弯,再逆流停到岸边,而不是直接停下,最后他请教船员,终于搞清楚了奥秘,你知道
- (作文)瞬间也精彩
- 高分子材料是研究什么的
猜你喜欢