已知圆半径和圆柱的高,计算圆柱体积和表面积。
Public Class Form1Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickConst PI = 3.14159Dim r As Integer, h As IntegerDim t As Single, s As Singler = Val(TextBox1.Text)h = Val(TextBox2.Text)t = PI * r * r * hs = 2 * PI * r * h + 2 * PI * r * rLabel3.Text = "体积=" & Format(t, "0.000")Label4.Text = "表面积=" & Format(s, "0.000")End Sub
End Class