Objętość stożka
Private Sub Command3_Click()
Dim R As Single
Dim H As Single
Dim wynik As Single
Dim pi As String
If IsNumeric(Text1.Text) = False Then
MsgBox "Nie poprawna wartość R"
Exit Sub
Else
R = CSng(Text1.Text)
End If
If IsNumeric(Text2.Text) = False Then
MsgBox "Nie poprawna wartość H"
Exit Sub
Else
H = CSng(Text2.Text)
End If
pi = 3.14
If R <> 0 Then
If H <> 0 Then
wynik = pi * 1 / 3 * R ^ 2 * H
Else
MsgBox "stożek nie istnieje"
End If
MsgBox "objętość stożka = " & wynik
End If
End Sub
Private Sub Command4_Click()
End
End Sub
Pole elipsy
Private Sub Command1_Click()
Const pi = 3.14
Dim a, b As Single
Dim S As Single
a = CSng(Text1.Text)
b = CSng(Text2.Text)
a = Val(Text1.Text)
b = Val(Text2.Text)
If IsNumeric(Text1.Text) = False Then
MsgBox "Niepoprawne dane wejściowe"
Exit Sub
End If
If IsNumeric(Text2.Text) = False Then
MsgBox "Niepoprawne dane wejściowe"
Exit Sub
End If
If a <= 0 And b <= 0 Then
MsgBox "Niepoprawne dane wejściowe"
Else
S = pi * a * b
MsgBox "Pole elipsy jest równe" & S
End If
End Sub