请教:VB6编程中,怎样输出这个等式“根号A=B”?想输出根号这个符号出来,不是结果。知道SQR()这个函数。
1个回答
展开全部
将以下代码放进记事本里,保存为*.frm。
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3540
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3540
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 735
Left = 1320
TabIndex = 2
Top = 1080
Width = 1455
End
Begin VB.Label Label1
Caption = "_"
Height = 210
Left = 720
TabIndex = 0
Top = 555
Width = 3420
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "√"
Height = 180
Left = 585
TabIndex = 1
Top = 750
Width = 180
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a As String
a = InputBox("请输入数字")
Dim i As Integer
Dim b As String
For i = 1 To Len(a)
b = b & "_"
Next
Label1.Caption = b
Label2.Caption = "√" & a & " =" & Sqr(Val(a))
End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3540
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3540
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 735
Left = 1320
TabIndex = 2
Top = 1080
Width = 1455
End
Begin VB.Label Label1
Caption = "_"
Height = 210
Left = 720
TabIndex = 0
Top = 555
Width = 3420
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "√"
Height = 180
Left = 585
TabIndex = 1
Top = 750
Width = 180
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a As String
a = InputBox("请输入数字")
Dim i As Integer
Dim b As String
For i = 1 To Len(a)
b = b & "_"
Next
Label1.Caption = b
Label2.Caption = "√" & a & " =" & Sqr(Val(a))
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询