VB 缂栫▼闂 - 宸茶В鍐?- 鎼滄悳闂棶
杩欐槸鑰佸笀缁欑殑涓€娈典唬鐮?br/>Dim ia() As String, k%
Private Sub command1_click()
For i = 1 To k - 1
For j = k To i + 1 Step -1
If ia(j) < ia(j - 1) Then
t = ia(j): ia(j) = ia(j - 1): ia(j - 1) = t
End If
Next j
Next i
Picture1.Cls
For i = 1 To k
Picture1.Print ia(i)
Next i
End Sub
Private Sub Text1_Keypress(KeyAscii As Integer)
If KeyAscii = 13 Then k = k + 1
ReDim Preserve ia(k)
ia(k) = Text1
Picture1.Print ia(k)
Text1 = ""
End Sub
鎸夐挳浣滅敤鏄帓搴?浣嗘槸鎺掑簭鍚庢棤娉曞湪picturebox鏄剧ず杩炵画鐨勫崟璇?
濡備綍淇敼
答案:鎸夎繖閬撻鐨勯鎰忓簲璇ユ槸杩欐牱鐨勶細
鍦╰ext1閲岃緭鍏ヤ竴涓暟锛屾寜鍥炶溅鍚庯紝缁х画杈撳叆锛屽苟鍦╬icture1涓墦鍗板嚭鏉ャ€?br/>鐐瑰嚮鎸夐挳鐨勬椂鍊欙紝鎺掑簭锛岀劧鍚庤緭鍑恒€?br/>
鍙兘鏄綘copy浠g爜鐨勬椂鍊欏紕閿欎簡锛屽簲璇ユ槸杩欐牱鍚э細
Dim ia() As String, k%
Private Sub command1_click()
For i = 1 To k - 1
For j = k To i + 1 Step -1
If ia(j) < ia(j - 1) Then
t = ia(j): ia(j) = ia(j - 1): ia(j - 1) = t
End If
Next j
Next i
Picture1.Cls
For i = 1 To k
Picture1.Print ia(i)
Next i
End Sub
Private Sub Text1_Keypress(KeyAscii As Integer)
If KeyAscii = 13 Then
k = k + 1
ReDim Preserve ia(k)
ia(k) = Text1
Picture1.Print ia(k)
Text1 = ""
End If
End Sub
涓嶇煡閬撲綘骞蹭粈涔堢殑锛屼絾绋嬪簭閿欒澶氬锛孫ption Explicit
Dim i%, j%, t$
Private Sub command1_click()
For i = 1 To k - 1
For j = k To i + 1 Step -1
If ia(j) < ia(j - 1) Then
t = ia(j): ia(j) = ia(j - 1): ia(j - 1) = t
End If
Next j
Next i
Picture1.Cls
For i = 0 To k
Picture1.Print ia(i);
Next i
End Sub
Private Sub Text1_Keypress(KeyAscii As Integer)
k = 1
If KeyAscii = 13 Then k = k + 1
ReDim Preserve ia(k)
ia(k) = Text1
Picture1.Print ia(k);
Text1 = ""
End Sub
妯″潡閲?br/>Option Explicit
Public k%, ia$()
上一个:VB编程问题
下一个:关于VB编程问题