:
. IfThenElse Select Case.
:
:
o ;
o IfThenElse Select Case;
o VB;
I. IfThenElse.
, , . ( ). , , .
.
:
If < > Then
< 1 >
Else
< 2 >
End If
True, < 1>. False, < 2>.
< 1> < 2> VB.
Else. .
If < > Then
< >
End If
True, , Then, , .
1.
:
X, Y, Z. , : .
:
Private Sub CommandButton1_Click() Dim x As Single, y As Single, z As Single Dim s As Single, p As Single x = Val(TextBox1.Text) y = Val(TextBox2.Text) z = Val(TextBox3.Text) p = x * y * z s = x + y + z If s > p Then , , True Label4.Caption = " " Else , , True Label4.Caption = " " End If End Sub |
2.
:
X Y. , , , .
Private Sub CommandButton1_Click() Dim x As Single, y As Single x = Val(TextBox1.Text) y = Val(TextBox2.Text) If (x > 0) And (y > 0) Then x = Sqr(x) y = Sqr(y) End If Label5.Caption = "X=" + Str(x) Label4.Caption = "Y=" + Str(y) End Sub |
|
|
II.
:
, . !
X, Y, Z. . | |
. , . | |
R S. , .. | |
, , : 7. | |
X, Y, Z , , . | |
X, Y. , . | |
X, Y. , [10; 20]. | |
. : , . | |
R . , Y. . : R2 = X2 + Y2 | |
. . . , . , . | |
. 3% , 500 ., 5% 1000 . | |
. . | |
, , . : ( ) 100. | |
, , . , , , , . | |
, , . |