VB编程,比较简单的,作业,急求

2024年11月29日 11:52
有4个网友回答
网友(1):

Private Sub Command1_Click() '点击应付
    a = Val(Text1)
    x7 = Int(a / 100)
    Y1 = a - x7 * 100
    x6 = Int(Y1 / 50)
    Y2 = Y1 - x6 * 50
    x5 = Int(Y2 / 20)
    Y3 = Y2 - x5 * 20
    x4 = Int(Y3 / 10)
    y4 = Y3 - x5 * 10
    x3 = Int(y4 / 5)
    X2 = y4 - x3 * 5
    Text7 = x7
    Text6 = x6
    Text5 = x5
    Text4 = x4
    Text3 = x3
    Text2 = X2
End Sub

Private Sub Command2_Click() '点击清空
    Text7 = ""
    Text6 = ""
    Text5 = ""
    Text4 = ""
    Text3 = ""
    Text2 = ""
    Text1 = ""
End Sub

网友(2):

如果command1是“应付”,command2是“清空”,command3是“退出”,程序如下:
Private Sub Command1_Click()
Dim A As Single
Dim B As Integer
A = Val(Text1.Text)
Text7.Text = A \ 100
B = A Mod 100
Text6.Text = B \ 50
B = B Mod 50
Text5.Text = B \ 10
B = B Mod 10
Text4.Text = B \ 5
B = B Mod 5
Text3.Text = B \ 2
Text2.Text = B Mod 2
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub

Private Sub Command3_Click()
End
End Sub

网友(3):

非常简单,连源文件都给你了。

网友(4):

724605360