vb.net 编写程序,帮帮忙!很急!
答案:1 悬赏:70 手机版
解决时间 2021-06-09 18:50
- 提问者网友:酱爆肉
- 2021-06-08 17:55
建立一个5行6列的矩阵,赋值并输出,找出其中最小元素所在的行和列,输出该值及其行、列位置。
最佳答案
- 五星知识达人网友:酒安江南
- 2021-06-08 18:23
Module Module1
Sub Main()
Dim a(,) As Integer
Dim x, y As Integer
x = 0
y = 0
ReDim a(5, 6)
For i As Integer = 0 To 4
Dim str = Console.ReadLine().Split(New Char() {" "})
For j As Integer = 0 To 5
a(i, j) = Integer.Parse(str(j))
If a(x, y) < a(i, j) Then
x = i
y = j
End If
Next j
Next i
Console.WriteLine("最大元素是:" & a(x, y))
Console.WriteLine("它的位置是:({0},{1})", x, y)
End Sub
End Module
Sub Main()
Dim a(,) As Integer
Dim x, y As Integer
x = 0
y = 0
ReDim a(5, 6)
For i As Integer = 0 To 4
Dim str = Console.ReadLine().Split(New Char() {" "})
For j As Integer = 0 To 5
a(i, j) = Integer.Parse(str(j))
If a(x, y) < a(i, j) Then
x = i
y = j
End If
Next j
Next i
Console.WriteLine("最大元素是:" & a(x, y))
Console.WriteLine("它的位置是:({0},{1})", x, y)
End Sub
End Module
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯