主题:[讨论]读程序,写程序功能和结果 急需拜托各位
Dim Array(3, 4) As Single
Dim t(3, 1) As Integer
Dim b(3) As Single
Dim i, j, k, minR, maxR As Integer
Dim String1, String2 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
For i = 0 To 3
For j = 0 To 4
Array(i, j) = Math.Round(Rnd() * 90, 1) + 10.1
Next
Next
For i = 0 To 3
For j = 0 To 4
String1 = String1 & CStr(Array(i, j)) & " "
Next
String1 = String1 & Chr(10)
Next
TextBox1.Text = String1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
k = 0
For i = 0 To 3
minR = 0
maxR = 0
For j = 0 To 4
If Array(i, maxR) < Array(i, j) Then maxR = i
If Array(i, minR) > Array(i, j) Then minR = j
Next
For j = 0 To 3
If Array(j, maxR) < Array(i, minR) Then Exit For
Next
If j > 3 Then
k = k + 1
b(k - 1) = Array(i, maxR)
t(k - 1, 0) = i
t(k - 1, 1) = maxR
End If
For j = 0 To 3
If Array(j, minR) > Array(i, minR) Then Exit For
Next
If j > 3 Then
k = k + 1
b(k - 1) = Array(i, minR)
t(k - 1, 0) = i
t(k - 1, 1) = minR
End If
Next
If k = 0 Then
MsgBox("没有所求值")
Else
For i = 0 To k - 1
String2 = String2 & "所求值:" & CStr(b(i)) _
& "行号:" & CStr(t(i, 0)) & "列号:" & CStr(t(i, 1)) & Chr(10)
Next
MsgBox(String2)
End If
End Sub
Dim t(3, 1) As Integer
Dim b(3) As Single
Dim i, j, k, minR, maxR As Integer
Dim String1, String2 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
For i = 0 To 3
For j = 0 To 4
Array(i, j) = Math.Round(Rnd() * 90, 1) + 10.1
Next
Next
For i = 0 To 3
For j = 0 To 4
String1 = String1 & CStr(Array(i, j)) & " "
Next
String1 = String1 & Chr(10)
Next
TextBox1.Text = String1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
k = 0
For i = 0 To 3
minR = 0
maxR = 0
For j = 0 To 4
If Array(i, maxR) < Array(i, j) Then maxR = i
If Array(i, minR) > Array(i, j) Then minR = j
Next
For j = 0 To 3
If Array(j, maxR) < Array(i, minR) Then Exit For
Next
If j > 3 Then
k = k + 1
b(k - 1) = Array(i, maxR)
t(k - 1, 0) = i
t(k - 1, 1) = maxR
End If
For j = 0 To 3
If Array(j, minR) > Array(i, minR) Then Exit For
Next
If j > 3 Then
k = k + 1
b(k - 1) = Array(i, minR)
t(k - 1, 0) = i
t(k - 1, 1) = minR
End If
Next
If k = 0 Then
MsgBox("没有所求值")
Else
For i = 0 To k - 1
String2 = String2 & "所求值:" & CStr(b(i)) _
& "行号:" & CStr(t(i, 0)) & "列号:" & CStr(t(i, 1)) & Chr(10)
Next
MsgBox(String2)
End If
End Sub