1、第 6 页 共 6 页1题;设计应用程序,输入圆柱体的底面半径和高,求底面积、侧面积、体积。要求:1)程序中将定义成符号常量。2)将输入的底面半径和高分别存于单精度变量r和h中。(窗体文件名A1.FRM,工程文件名A1.VBP) Const pi As Single = 3.1415926Private Sub Command1_Click()Dim h As SingleDim r As Singleh = Val(Text1.Text)r = Val(Text2.Text)Text3.Text = Format(pi * r 2, 0.000)Text4.Text = Format(2 *
2、 pi * r * h, 0.000)Text5.Text = Format(pi * r 2 * h, 0.000)End Sub2题;用块结构条件语句实现。要求用InputBox函数输入三个数,找出并输出三个数中的最大数及最小数。(窗体文件名A2.FRM,工程文件名A2.VBP)Private Sub Form_Click()Dim Max As Integer, Min As Integer, a(1 To 3) As Integer For i = 1 To 3 a(i) = Val(InputBox(请输入数值, 找出最大和最小值, 0)Next iMax = a(1)Min = a(1)For i = 1 To 3 If a(i) Max Then Max = a(i) End If If a(i) Max Then Max = D(i) End If If D(i) Min Then Min = D(i) End IfNext iText4.Text = MaxText5.Text = MinEnd Sub