VB实验 过程应用程序设计

 我来答
东问鲆6V
2014-05-14 · TA获得超过142个赞
知道小有建树答主
回答量:65
采纳率:0%
帮助的人:83.7万
展开全部
Function Prime(n As Integer) As Boolean
Dim i As Integer
Prime = True
For i = 2 To Sqr(n)
If n / i = n \ i Then Prime = False: Exit For
Next i
MsgBox Prime
End Function

Function Max() As Integer
Dim a(99) As Integer
Dim i%, min%
Randomize
For i = 0 To 99
a(i) = Int(Rnd * 100)
Next
min = a(0)
For i = 0 To UBound(a)
If a(i) < min Then min = a(i)
Next
MsgBox min
End Function

Function Multiply(n As Long) As Long
Dim i As Long
Multiply = 1
For i = 1 To n
Multiply = Multiply * i
Next
MsgBox Multiply
End Function

Function fun4() As Double
Dim a%, b%, c%, d%, i%
Dim n As Double
a = 3: b = 5: c = 7: d = 9: n = 10
fun4 = 0
n = 0
For i = 0 To a
n = n + a ^ i
Next
fun4 = fun4 + a / n
n = 0
For i = 0 To b
n = n + b ^ i
Next
fun4 = fun4 + b / n
n = 0
For i = 0 To c
n = n + c ^ i
Next
fun4 = fun4 + c / n
n = 0
For i = 0 To d
n = n + d ^ i
Next
fun4 = fun4 + d / n
MsgBox fun4
End Function

Function SReplace(s As String, s1 As String, s2 As String) As String
Do While InStr(s, s1) > 0
s = Replace(s, s1, s2)
Loop
MsgBox s
End Function
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式