實(shí)現(xiàn)上述功能的VB程序如下,但加框處代碼有錯(cuò),請(qǐng)改正。 Dim b(1 To 20)As Integer,n As Integer Private Sub Command1_Click ( ?。?br />Dim i As Integer,j As Integer,x As Single,s As String x=Val(Text1.Text) List1.AddItem Text1.Text n=n+1 j=1 Do While j<n And x>b(j) j=j+1 Loop For‘改錯(cuò) b(i+1)=b(i) Next i b(j)=x For i=1To n
‘填空 Next i List2.AddItems Text1.Text=″″ End Sub (1)代碼“Private Sub Command1_Click( ?。敝械腃ommand1是
Dim r As Integer′矩陣行數(shù) Dim c As Integer′矩陣列數(shù) Dim a(1 To 100)As Integer Private Sub Form_Load ( ?。?br />Dim i As Integer,s As String Randomize List l.Clear r=Int(Rnd*5)+3 c=Int(Rnd*5)+3 For i=1Tor*c a(i)=①
'生成10~99的隨機(jī)整數(shù) s=s+Str(a(i)) If i Mod c=0 Then List1.Add Items s=″″ End If Next i End Sub Private Sub Command1_Click( ) Dim m As Integer,n As Integer,s As String m=Val(Text1.Text):n=Val(Text2.Text) List2.Clear For i=1To②
k=a((m-1)*c+i) a((m-1)*c+i)=a((n-1)*c+i) a((n-1)*c+i)=k Next i For i=1 To r For j=1 To c s=③
Next j List2.AddItem s s=″″ Next i End Sub 請(qǐng)回答下列問題: (1)若生成矩陣如圖所示,若文本框Text1中輸入m為2,Text2中輸入n為4時(shí),單擊“交換行”按鈕 Command1,程序運(yùn)行結(jié)束,數(shù)組元素a(5)的值為