网问答>>Vb编程,运行某工程时,用文本框输入x值,单击计算Y按钮Command1时,按以下公式计算Y?
问题
已解决

Vb编程,运行某工程时,用文本框输入x值,单击计算Y按钮Command1时,按以下公式计算Y?

时间:2020-07-10 20:48:57
运行某工程时,用文本框Text1输入X值,单击“计算Y”按钮Command1时,按以下公式计算Y,并将计算结果显示于标签Label2中。完成“计算Y”按钮的Click事件过程。y=|x|x≤0xx>0
最佳回答
Dim a(1 To 50) As IntegerPrivate Sub Command1_Click() x = Val(Text1) If x = 0 Then y = -x Else y = Sqr(x) Label2.Caption = yEnd SubPrivate Sub Form_Load() Me.Caption = "计算分段函数" Text1 = "" Label1.Caption = "请输入x" Label2.Caption = "" Command1.Caption = "计算y"End Sub
时间:2020-07-10 20:48:58
本类最有帮助
Copyright © 2008-2013 www.wangwenda.com All rights reserved.冀ICP备12000710号-1
投诉邮箱: