用VB做将输入的字符反向输出
例如abcd输出为dcba利用随机函数产生50--100内的20个随机数,显示其中的最大值最小值平均值用VB做谢谢了高手门急需...
例如 abcd 输出为 dcba
利用随机函数产生50--100内的20个随机数,显示其中的最大值
最小值 平均值
用VB做 谢谢了高手门 急需 展开
利用随机函数产生50--100内的20个随机数,显示其中的最大值
最小值 平均值
用VB做 谢谢了高手门 急需 展开
2个回答
展开全部
第一题:
Dim s As String
s = InputBox("输入一个字符串:", "输入", "abcd")
MsgBox StrReverse(s)
第二题:
Dim n(1 To 20) As Integer, i As Integer
Dim Max As Integer, Min As Integer, s As Long
Randomize: Max = -32767: Min = 32767: s = 0
For i = 1 To 20
n(i) = Int(51 * Rnd + 50)
If n(i) > Max Then Max = n(i)
If n(i) < Min Then Min = n(i)
s = s + n(i)
Print n(i)
Next i
s = s / 20
MsgBox "最大值:" & Max & ",最小值:" & Min & ",平均值:" & s & "。"
Dim s As String
s = InputBox("输入一个字符串:", "输入", "abcd")
MsgBox StrReverse(s)
第二题:
Dim n(1 To 20) As Integer, i As Integer
Dim Max As Integer, Min As Integer, s As Long
Randomize: Max = -32767: Min = 32767: s = 0
For i = 1 To 20
n(i) = Int(51 * Rnd + 50)
If n(i) > Max Then Max = n(i)
If n(i) < Min Then Min = n(i)
s = s + n(i)
Print n(i)
Next i
s = s / 20
MsgBox "最大值:" & Max & ",最小值:" & Min & ",平均值:" & s & "。"
展开全部
1.StrReverse("abcd")
2.
Private Sub Command1_Click()
Dim a%(1 To 20), i%, max%, min%, pjs%
For i = 1 To 20
a(i) = Int(51 * Rnd + 50) '得到20个随机数放入数组a
Next
min = 100: max = 0
For i = 1 To 20
If a(i) > max Then max = a(i)
If a(i) < min Then min = a(i)
pjs = pjs + a(i)
Next
pjs = pjs / 20
Print "最大的数:"; max
Print "最小的数:"; min
Print "平均数:"; pjs
End Sub
2.
Private Sub Command1_Click()
Dim a%(1 To 20), i%, max%, min%, pjs%
For i = 1 To 20
a(i) = Int(51 * Rnd + 50) '得到20个随机数放入数组a
Next
min = 100: max = 0
For i = 1 To 20
If a(i) > max Then max = a(i)
If a(i) < min Then min = a(i)
pjs = pjs + a(i)
Next
pjs = pjs / 20
Print "最大的数:"; max
Print "最小的数:"; min
Print "平均数:"; pjs
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询