達標題目源代碼
達標題目源代碼
A類題源代碼
1、?比較大小:根據輸入文字大小,在中間的標簽中顯示大于、小于或等于符號
Private Sub Command1_Click()
Dim x? As Integer, y As Integer
x = Val(Text1.Text): y = Val(Text2.Text)
If x < y Then??????????? '判斷x>y是否為真如果為真執行下面程序
?? Label1.Caption = "<"
ElseIf x > y Then
?? Label1.Caption = ">"
Else
?? Label1.Caption = "="
?End If
End Sub
2、?計算1到100的和:點計算按鈕顯示出結果
Private Sub Command1_Click()
For i = 1 To 100
s = s + i
Next
Label2.Caption = s
End Sub
3、?三個文本框,在前兩上文本框中輸入數字,點“加法運算”按鈕,顯示出結果。
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command2_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub Command3_Click()
End
End Sub
4、?兩個文本框,在第一個文本框輸入數字,點“計算”按鈕,顯示“這是一個奇數”或“這是一個偶數”
Private Sub Command1_Click()
Dim int1 As Integer, int2 As Integer
int1 = Val(Text1.Text)
int2 = int1 Mod 2????????????????????????? '整除2取余數
If int2 = 0 Then??????????????????????????? '判斷是否為偶數
Text2.Text = "這是一個偶數!"
Else
Text2.Text = "這是一個奇數!"
End If
End Sub
5、?在兩個文本框中輸入數字,點“計算”按鈕,顯示出運算值和余數。
Private Sub Command1_Click()
a = Fix(Text1.Text / Text2.Text)
b = Text1.Text - Text2.Text * a
Label3.Caption = a
Label5.Caption = b
End Sub
6、?要求在窗體上點擊后顯示出一個倒立的直角三角形圖案
Private Sub Form_Click()
Dim i, j As Integer
For i = 1 To 5
? For j = 1 To i
??? Print "*";
? Next j
? Print
Next i
End Sub
B類題源代碼
1、?小車運動:點前進按鈕,小車往前進,在紅綠燈處停止;點后退按鈕,小車后退到起點停止。
Private Sub Command1_Click()
While image1.Left <= 3300
image1.Left = image1.Left + 1
Wend
image2.Visible = True
End Sub
Private Sub Command2_Click()
While image1.Left >= 0
image1.Left = image1.Left - 1
Wend
End Sub
Private Sub Form_Load()
image1.Left = 0
End Sub
非常好我支持^.^
(0) 0%
不好我反對
(0) 0%