VB 编写程序,求函数y的值(当x小于等于0时,y=3x+1;当x>0时,y=4x+1)

问题描述:

VB 编写程序,求函数y的值(当x小于等于0时,y=3x+1;当x>0时,y=4x+1)

Dim ax,y As Integer
Private Sub Command1_Click()
x = Text1.Text
If x > 0 Then
y = 4 * x + 1
Else:y = 3 * x + 1
End If
Text2.Text = y
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub