能不能将vb的代码转换为VB.NET的代码,困难
2个回答
展开全部
可以发过来看看
Dim str As String = "", temp, n As Integer
Dim str1 As String = "12,45,2,9,41,31,66,83,2,1,-9,-91,-21"
Dim a() As String = Split(str1, ",")
For i = 1 To UBound(a) Step 1
a(i) = Val(a(i))
Next
temp = 0
n = 0
For i = 1 To UBound(a)
If a(i) > temp Then
temp = a(i)
End If
If a(i) > 0 Then
n = n + 1
End If
Next
str = str & "正数的个数为 " & n
str = str & "最大元素的下标为 "
For i = 1 To UBound(a)
If a(i) = temp Then
str = str & i & " "
End If
Next
TextBox6.Text = str
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询