关于VB编程的计算圆的面积和周长

2024-12-03 10:55:26
推荐回答(2个)
回答1:

Const pi As Double = 3.141592
Private Sub Form_Resize()
Dim rad As Integer
Dim area As Double
Dim pre As Double rad = 10
area = pi * rad * rad
pre = 2 * pi * rad Print "半径="; rad
Print "圆面积="; area
Print "圆周长="; pre
End Sub

回答2:

Private Sub Form_Load() ……End Sub之间的Print 语句,是无法显示在窗体上的,建议写在窗体的单击事件里。如下:Private Sub Form_Click()……End Sub