编写VB代码,已知存放在数组中的6个数,用选择法按递增顺序排序
推荐于2016-04-25
展开全部
Dim a(1 To 6) As Integer
Private Sub Command1_Click()
Dim t As Integer
For i = 1 To 5
t = i
For j = i + 1 To 6
If a(t) > a(j) Then t = j
Next j
b = a(i): a(i) = a(t): a(t) = b
Next i
Print "排序后的数组为:"
For i = 1 To 6
Print a(i);
Next i
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Randomize
Print "排序前的数组为:"
For i = 1 To 6
a(i) = Int(Rnd * 90 + 10)
Print a(i);
Next i
End Sub
追问
编程求解一元二次方程ax平方+bx+c的根,输入系数a,b,c,求输入的两个根x1,x2怎么做
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询