谁救救我吧,我做vb快疯了!!万分感谢啊!
发布网友
发布时间:2024-09-30 14:07
我来回答
共3个回答
热心网友
时间:2024-10-01 13:08
Dim a(6, 6)
Private Sub Command1_Click()
For i = 0 To 5
For j = 0 To 5
a(i, j) = Int(100 * Rnd)
Print a(i, j),
Next j
Print
Next i
End Sub
Private Sub Command2_Click()
c = CInt(InputBox("输入要查找的行", , "1")) - 1
Print "第" & (c + 1) & "行的最大值位于第" & findmax(c) + 1 & "列"
End Sub
Private Sub Form_Load()
Command1.Caption = "生成"
Command2.Caption = "查找"
End Sub
Public Function findmax(ByRef row) As Integer
m = a(row, 0)
findmax = 0
For j = 1 To 5
If a(row, j) > m Then findmax = j
Next j
End Function
热心网友
时间:2024-10-01 13:02
你在哪里做vb啊,推荐些题目给我好不?
Dim a(6, 6) As Integer
For i = 0 To 5
For p = 0 To 5
randomize()
a(i, p) = CInt(Rnd() * 100)
Next
Dim s As Integer
s = InputBox("请输入行号")
Dim Ma As Integer = 0
Dim Lie As Integer
For i = 0 To 5
If Ma < a(s - 1, i) Then
Ma = a(s - 1, i)
Lie = i + 1
End If
Next
MsgBox(Lie)
热心网友
时间:2024-10-01 13:02
看代码:
Private Sub Command1_Click()
Dim Sn As Double, k As Double
Dim a As Integer, n As Integer, i As Integer
Randomize
a = 1 + Int(9 * Rnd)
n = 5 + Int(6 * Rnd)
For i = 1 To n
Sn = Sn + a * 10 ^ (i - 1) + k
k = a * 10 ^ (i - 1) + k
Next
Print "a=" & a, "n=" & n, "Sn=" & Sn
End Sub
说明:
1、Sn是n项和
2、因Sn、k初值为0,故i=1时,Sn=a k=a
3、i=2时,Sn=a+a*10+k=a+aa k=aa
4、i=3时,Sn=a+aa+a*10^2+k=a+aa+aaa k=aaa
。。。。。。。。
效果见图。符合你的要求,给分!!!