VB关于圆的周长和面积的代码。。。。

具体如图,求代码。。。。。。。

第1个回答  2014-03-10
Dim r, s, c As Integer
Private Sub Command1_Click()
r = Val(Text1.Text)
s = 3.1415926 * r ^ 2
c = 2 * 3.1415926 * r
Label1.Caption = "周长是:" & c
Label2.Caption = "面积是:" & s
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Label1.Caption = ""
Label2.Caption = ""
End Sub
第2个回答  2014-03-10
Dim r, s, l As Single:

Private Sub mianji_Click() '面积
r = Val(Text1.Text)
s = 3.1415926 ^ 2 * r
Text3.Text = s
End Sub

Private Sub zhouchang_Click() '周长
r = Val(Text1.Text)
l = 2 * 3.1425926 * r
Text2.Text = l
End Sub本回答被网友采纳

VB关于圆的周长和面积的代码。。。
s = 3.1415926 * r ^ 2 c = 2 * 3.1415926 * r Label1.Caption = "周长是:" & c Label2.Caption = "面积是:" & s End Sub Private Sub Command2_Click()Text1.Text = ""Label1.Caption = ""Label2.Caption = ""End Sub ...

用VB怎么求圆的周长?
可以参考下面的代码:Private Sub Command1_Click()Dim p As Single Dim s As Single Dim r As Single p = 3.1415 '定义周长率的值 r = InputBox("请输入一个圆的半径", "输入", 0) '获取输入值 s = p * r ^ 2 '面积公式 c = 2 * p * r '周长公式 MsgBox ("圆的面积为:...

用vb编程,求圆的周长与面积,代码怎么写?急求,跪谢啊!
s=3.1416*x*x msgbox z msgbox s end sub

VB输入半径,计算圆周长和圆面积。
运行通过,希望对你有帮助。\\x0d\\x0aPrivateSubCommand1_Click()\\x0d\\x0aDimrAsDouble\\x0d\\x0ar=Val(Text1.Text)\\x0d\\x0ac=2*3.14*r\\x0d\\x0as=3.14*r*r\\x0d\\x0aPrint"周长c=";c;"面积s=";s\\x0d\\x0aEndSub\\x0d\\x0a\\x0d\\x0aPrivateSubForm_Load()\\x0d\\x0aM...

设计VB计算圆的面积与周长
2 L = 3.1415926 * D MsgBox ("圆的面积" & S & vbCrLf & "圆的周长" & L)End Sub Private Sub Command2_Click()R = InputBox("请输入圆的半径")S = 3.1415926 * (R ^ 2)L = 2 * 3.1415926 * R MsgBox ("圆的面积" & S & vbCrLf & "圆的周长" & L)End Sub ...

VB输入半径,计算圆周长和圆面积。
运行通过,希望对你有帮助。Private Sub Command1_Click()Dim r As Double r = Val(Text1.Text)c = 2 * 3.14 * r s = 3.14 * r * r Print "周长c="; c; "面积s="; s End Sub Private Sub Form_Load()Me.Show Text1.Text = ""MsgBox "请输入要计算的圆的半径"Text1.Set...

求帮忙编写VB程序 输入半径后计算圆周长、圆面积、圆球表面积和圆球体...
r = Text1.Text C = 2 * Pi * r s = Pi * r * r SSA = 4 * Pi * r * r V = 4 \/ 3 * Pi * r * r * r Form1.Cls Print "圆周长为:" & Format(C, "#0.000")Print "圆面积为:" & Format(s, "#0.000")Print "球表面积为:" & Format(SSA, "#0.000"...

vb编程:输入半径,求圆形面积
Private Sub Command1_Click()Dim r As Double r = InputBox("请输入半径:", "输入半径")Print "圆的面积是: (r ^ 2 * 3.14159)"End Sub 在窗体上建立一个按扭然后双击进去,输入上面的代码就可以了!

用vb6.0做求圆的周长和面积的程序代码
Const PI = 3.1415926 Dim R As Integer, Area As Double, Perimeter As Double R = Val(Text1.Text) ’不是Test1.Test Area = PI * R * R Perimeter = 2 * PI * R Label1.Caption = R & " - --" & Area & " - --" & Perimeter '或者 Label1.Caption = Cstr(R) & "...

怎样用VB计算圆的面积和周长要从头开始
Const pi As Single = 3.141593Private Sub Form_Click()Dim r As Singler = Val(InputBox("请输入圆的半径:"))MsgBox "这个圆的面积为" & pi * r ^ 2 & vbCrLF & "周长为" & 2 * pi * rEnd Sub

相似回答