Function Pr4310(ByVal x As Double_ ByVal y As Double) As Double Dim f As Double If x > y Then f = x Else f = y Return f End Function |
. 4.4.3-10. Pr4310()
4.3-3
.4.4.3-11 4.4.3-12.
Function Pr4311(ByVal x As Double_ ByVal y As Double) As Double Dim f As Double f = x If y > f Then f = y Return f End Function |
. 4.4.3-11. Pr4311() 4.3-3
(. 4.4.3-10) , (.4.4.3-11) .
- Function Pr4310() ( Pr4311()) , , . 4.4.3-12.
, :
If x > y Then f=x Else f=y f = max{x, y},
If x < y Then f=x Else f=y f = min{x, y },
x y .
Dim ff As Double Dim xx, yy As Double xx= vvodDbl2(" x=", TextBox1) yy= vvodDbl2(" y=", TextBox2) ff=Pr4311(xx, yy) vivodDbl2(ff, "max{x, y }= ", TextBox3) |
. 4.4.3-12. Pr4311()
4.3-3
4.4.3-4. -Function, r = min{ a+b, c2, }.
Function Pr4313(ByVal a As Double_ ByVal b As Double_ ByVal c As Double _ ByVal d As Double) As Double Dim min As Double min = a + b If c^2 < min Then min = c^2 If Sqrt(d) < min Then min = Sqrt(d) Return min End Function |
. 4.4.3-13. Pr4313() 4.3-4
() .
, 4.4.3-4 (.4.4.3-13), . . min . .
- Function Pr4313() ,
. 4.4.3-14.
Dim rr As Double Dim aa, bb, cc, dd As Double aa = vvodDbl2(" a=", TextBox1) bb = vvodDbl2(" b=", TextBox2) cc = vvodDbl2(" c=", TextBox3) dd = vvodDbl2(" d=", TextBox4) rr = Pr4313(aa, bb, cc, dd) ivodDbl2(rr," min = ", TextBox5) |
. 4.4.3-14. Pr4313() 4.3-4
4.4.3-5. -Function, y(x) :
|
|
ex, x<=-1;
y(x)= 3, x>1;
2, 1<≤1.
Function Pr4315(ByVal x As Double)_ As Double Dim y As Double If x <= -1 Then y = Exp(x) ElseIf x > 1 Then y=3 Else y=2 End If Return y End Function |
. 4.4.3-15. Pr4315()
- Function Pr4315() , , . 4.4.3-16.
Dim YY As Double Dim x As Double x= vvodDbl2(" x=", TextBox1) YY=Pr4315(x) vivodDbl2(YY," ", TextBox2) |
. 4.4.3-16. Pr4315()
4.3-5
4.4.3-6. x0, y0. (x0, y0) : (0, 1), (1, 0), (0, -1), (-1, 0).
, , (. 4.4.3-17).
. 4.4.3-17. (0, 1), (1, 0), (0, -1), (-1, 0)
, ax+by=c , ax+by≤c ax+by≥c , ( ), . , ,
M(x1, y1) ( M(0, 0), ).
, , M , . AB, BC, CD, DA:
AB: x-y=-1; BC: x+y=1; CD: x-y=1; DA: x+y=-1.
, M0(x0, y0) , :
.
, :
1) - Resh(), , .
2) - vvod() TextBox.
3) - vivod() TextBox.
4) , .
5) . 4.4.3-18.
Option Strict On Option Explicit On Imports System.Math Public Class Form1 ' TextBox Function vvod(ByVal T As TextBox) As Double Return CDbl(T.Text) End Function ' TextBox Sub vivod(ByVal Z As String, ByRef T As TextBox) T.Text = Z End Sub ' Sub Resh(ByVal x0 As Double, ByVal y0 As Double, _ ByRef z As String) If Abs(x0 - y0) <= 1 And Abs(x0 + y0) <= 1 Then z = " " Else z = " " End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) _ Handles Button1.Click Dim x, y As Double Dim z As String x = vvod(TextBox1): y = vvod(TextBox2) Resh(x, y, z): vivod(z, TextBox3) End Sub End Class |
. 4.4.3-18. 4.3-6
4.4.3-7. n. n , 10, f 1, n , f 2, n , f -1, n [10;1000], f 10, f 0.
|
|
Function Pr4319(ByVal n As Integer) As Integer Dim f As Integer Select Case n Case 1, 3, 5, 7, 9 f =1 Case 2, 4, 6, 8 f =2 Case Is <0 f =-1 Case 10 TO 1000 f =10 Case Else f =0 End Select Return f End Function |
.4.4.3-19. Pr4319()
4.4.3-7
4.4.3-7 Select Case .4.4.3-19.
- Function Pr4319() , , . 4.4.3-20.
Dim ff As Integer Dim nn As Integer nn= vvodInt4(TextBox1) ff=Pr4319(nn) vivodInt4(ff, TextBox2)) |
. 4.4.3-20. Pr4319()
4.3-7
1.
1) If...Then...Else
2) For...Next
3) While...Wend
4) Select Case
5) Do Until...Loop
2. If-Then
1)
2)
3)
4)
3. If-Then-Else
1)
2)
3)
4)
4. If-Then
1)
2)
3)
4)
5.
1) , , ,
2) , ,
3) , , ,
4)
6. If
1) End If
2) Else
3) Then
4) ThenElse
7.
1) If a>a Then c=1: d =5
2) If a>a Then c=1: d =5
3) If a+b Then c=1: d=5
4) If a>B Then c=1 Else d=5
8.
1)
2)
3)
4)
5)
9. If Then
1) Visual Basic
2)
3)
4)
10. x, y, z
x = 66: y = 58 If x > y Then z = x - y If x <= y Then z = x y |
1) 58 58 124
2) 66 58 08
3) 58 58 0
11. z ###
a = 15: b = 10: c = 25 If a > b And a < c Then z = a Else z = c End If |
12. , , X Y
1) = Abs(-Y) / 2 + (X + Y) / 2
2) If X > Y Then MAX = X
3) If X < Y Then MAX = Y
4) If X > Y Then MAX = X Else MAX = Y
5) MAX = ABS(X - Y) / 2 - (X + Y) / 2
13. Not((X<=10) Or (X>= 20))
1) (10;20)
2) (10;20)
3) [10;20]
4) [10;20]
14.
1) If X < 2 Then Y = Abs(X): Y = X^2
2) If X < 2 Then Y = X^2: Y = Abs(X)
3) If X < 2 Then Y = Abs(X) Else Y = X ^ 2
4) If X < 2 Then Y = X^2 Else Y = Abs(X)
15. (, )
#
1) ((x-2)**2+y*y<=4) Or (y>x/2)
|
|
2) (x-2)**2+y*y<=4 Or y>x/2
16. , ,
1) (x>-1) Or (y<1) Or (x-y<2)
2) (x>-1) And (y<1) And (x-y<2)
3) (x>-1) Or (y<1) Or (x+y>2)
4) (x>-1) Or (y<1) And (x+y>2)
5) (x>-1) And (y<1) Or (x+y>2)
17. , ,
1) (x<3) And (y<1) And (x+y>0)
2) (x<3) Or (y<1) Or (y<x)
3) (x<3) Or (y<1) Or (x+y>0)
4) (x<3) Or (y<1) And (x-y>0)
5) (x<3) Or (y<1) Or (x-y<0)
6)
18. , ,
1) (x >-1) And (y<3) And (x<y)
2) (x >-1) Or (y<3) Or (x>y)
3) (x >-1) Or (y<3) Or (x<y)
4) (x >-1) Or (y<3) And (x>y)
5) (x >-1) Or (x>y) And (y<3)
19. , ,
1) Sqrt(x*x+y*y)<R Or y>0
2) Sqrt(x*x+y*y)<R Or y<0
3) Abs(x)<R Or y>0 Or y<R
4) Abs(x)<R Or y<0 Or y>-R
5) Abs(x)<R Or Abs(y)<R
20. , ,
1) Abs(x)<R Or y<0 Or y>-R
2) Sqrt(x*x+y*y)<R Or y<0
3) Abs(x)<R Or y>0 Or y<R
4) Sqrt(x*x+y*y)<R Or y>0
5) Abs(x)<R Or Abs(y)<R
4.4.5.
, , , Select Case.
,
1) , .
2) .
3) .
4) Select Case.
1) ( 4).
2) -4.4.
3) . 4.4.5-1.
4) .
5) .
6) .
7) . , . () .
8) .
4.4.5-1
1) | e= |
2) | z= |
3) | z= |
4) | z= |
5) | g= |
6) | f= |
7) | d= |
8) | z= |
9) | z= |
10) | d= |
11) | |
12) | p= |
13) | r= |
14) | r= |
15) | s= |
16) | t= |
17) | u= |
18) | f= |
19) | |
20) | v= |
21) | h= |
22) | z= |
23) | |
24) | l= |
25) | Z= |
26) | z= |
27) | z= |
28) | |
29) | |
30) | y= |
4.4.5.4.