Dim a (5) As Single For i = 0 To 5 a(i) = i Next i TextBox1.Text = CStr(a(i)) |
1) 5
2)
3) 6
4) 0
Dim a (5) Single For i = 1 To 7 TextBox1.Text = TextBox1.Text & CStr(a(i)) & " " Next i |
1)
2)
3)
4)
For i = k To n - 1 a(i) = a(i+1) Next i |
1)
2)
3) K
4) N-K
For i = 0 To n-1 For j = i + 1 To n If a(i) < a(j) Then r = a(i): a(i) = a(j): a(j) = r Next j Next i |
1)
2)
3)
4)
i=0 Do If a(i) = 0 Then For j = i To n-1 a(j) = a(j+1) Next j n = n-1 Else i = i + 1 End If Loop While i <= n |
1)
2)
3)
4) -
k = 0: s = 0 For i = 0 To 5 If a(i) = 0 Then k = k + 1: If a(i) < 0 Then s = s + a(i) Next i TextBox1.Text=CStr(s) & " " & CStr(k) |
1) , 0,
2)
3) , 0,
4) , 0
j = -1 For i = 0 To n If a(i) > 0 Then j = j + 1: m(j) = i End If Next i |
1) a() m
2) , () m
3) m a()
4) a()
N,
DIM B(100), , I, N As Integer Sub Button1_Click() For I = 0 To 100 B(I) = INT(RND*100) Next I M = B(1) For I = 1 T 100 If B(I)< M Then M = B(I): N = I End If Next I TextBox1.Text = CStr(N) End Sub |
1)
2)
3)
4)
k = 2: n = 10 For i = k To n-1 a(i) = a(i+1) Next i |
1) k -
2)
|
|
3) k
4) n-k
j = -1 For i = 0 To 10 If a(i) < 0 Then j = j + 1: b(j) = a(i)^2 End If Next i |
1) b() a()
2) , ()
3) b()
4) b()
16.
4.7.7.
: , , , , .
,
1) .
2) .
3) : ; ; ; .
4) : () ; ( ) () ; ; ( ); , ( ); ( ).
5) Array.
6) ListBox ComboBox.
4.7.7.2.
1) ( 7).
2) -4.7.
3) . 4.7.7-1.
4) .
5) , .
6) .
7) , , , , . . , .
8) , .
9) .
10) .
4.7.7-1
1) | x= {-1.5, 0.1, 12, 0, -2.2, 0.5, -1, 0.3}. , . |
2) | a = {5, -2, 0, 3, 4, 12, 7}. , . |
3) | x = {-1.5, 0, 0.8, 2.2, 3, 0.5, 0.1}. , [-1;1], y , y. |
4) | a(5) b(5), . , a b. |
5) | b = {7.35, 0.12, -7, 3.12, 2.87, -4.12, 5.32, 0, 6.5}. . , |
6) | a={2.35,-4.15,0,-3.1, 7.8, 6.3,-3.05,1.5}. a , . . |
7) | a(10) , [-2, 6] , z. |
8) | , 20 ( [-5, 8]), , . . |
9) | 10 . . , . |
10) | x = {4.1, 16, 0, -3.2, 12}Y = {4, 5.1, 6}. z, y x. z , . |
11) | z = {0, 1.6, 6.4, 3.8, -7, 1, -2}a = {5,4,6.4,1}. a z . , , . |
12) | n = {3, 5, 7, 9, -11, 13, 15}. n , . |
13) | x = {-6, 0.5, 0.12, 13, -10.1} y = {13, 2.1, 14, 6, -2}. r() , x, - y. r. r , . |
14) | l = {13, 4, -2, 6, 7, -1, -5, 2, -3, 4}. m[0]n[0]+m[1]n[1]++m[k]n[k], m[0], m[1],m[p] - l, ; n[0], n[1],n[q] l, ; k = min{p,q}. |
15) | , 20 ( [-3, 10]), , . . |
16) | , 15 ( [-10, 10]), , . . |
17) | , 20 ( [-4, 7]), , , , , . . |
18) | m = {6, 10, 7, 14, 12, 12,-2, 3,-9, 6,-10}. , 2 3. k. |
19) | , 20 ( [-15, 15]), , . |
20) | l = {7, 6, 15, 17, 12, -12, 4, 0, -10, -22}. , 5 2. . |
21) | k = {1, 2, 3, 4, 6, 5, 8, 9, 10}. ""; - "". , , [a, b]. |
22) | q = {1.5, 2, 3.1, 4.2, 6, 7.5, 8.3, 9}. k, s , . . |
23) | , 15 ( [-7, 10]), . , , 4, . |
24) | b={-15.1,0.8, 32.3, 7.5,-1.5, 2.4, -6.3, 15.5}. , , . |
25) | , 20 ( [-3, 9]), , . |
26) | m = {14, 6, 3, 0, 7, 12, -3, 1, 5, 2}. , 3. k |
27) | m = {-1, 0, 10, -3, -5, 6, -2, 3, 4}. . n, m. |
28) | a= {-2, 0, -3.1, 4.6, -1}, b = {4, 7, -9.1, 1.2, -0.3}. a b z. z , . |
29) | , 20 ( [-5, 5]), . , , . |
30) | y = {2.5, -4.9, 10.2, -7.12, 3.1, -2, 6}. z, y, z. |
31) | x = {-1, 2, 3, 4, -5, 0,17, -6, 8, 9}. y x. y , . |
32) | g = {-3.1, 2.8, 0, 5, 7.7, -7.5, 0, 7.6, 3, 0}. . , , - . |
33) | k = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. k(i), k(i+1), i = 0, 2, 4, 6, 8. |
34) | x = {6,3.8, -9.3, 2.87,16, 5, 0.2, -3.1,1,10}. Y, : |
35) | z = {-2, 0, 3.5, 7, -12, 5, -1, 3}. r , z. r. |
4.7.7.4..
|
|
|
|
|
|
1) .
2) , , , .
3) .
4) .
5) , :
5.1) ;
5.2) ;
5.3) ;
5.4) .
6) .
7) .
1) :
.
.
2) , , , :
., 1405, 13.
3) :
a(n), , . , ,
4) :
( vvod()) : ; ; .
: ; ; .
5) , :
5.1) :
,
, . 4.7.7-1.
ComboBox ( ).
ComboBox ListBox TextBox, , . Items. Items (, Add() , Remove() , Insert() ), ComboBox. Clear() .
Propertie s SelectionMode. . , One () .
Items. , , , , . , ComboBox1.Items(0 ).
. 4.7.7-1. 7-1 :
5.2) :
. 4.7.7-2 .
4.7.7-2
Label1 | ForeColor | Red() |
Font | Times New Roman, Bold (), 10-point (10 ) | |
AutoSize | True | |
Name | Label1 | |
Text | 1. | |
Label2 | ForeColor | Red() |
Font | Times New Roman, Bold (), 10-point (10 ) | |
AutoSize | True | |
Name | Label2 | |
Text | ||
Label3 | Font | Times New Roman, Bold (), 14-point (14 ) |
ForeColor | ||
Name | Label3 | |
Text | ||
Label5 | Font | Times New Roman, Bold (), 10-point (10 ) |
Name | Label5 | |
Text | (), , | |
Label8 | ForeColor | Red() |
Name | Label8 | |
Text | : | |
Label10 | Font | 10 |
Name | Label10 | |
Text | ||
Label11 | AutoSize | False |
ForeColor | ||
Name | Label11 | |
Text | : | |
Label6 | Font | Times New Roman, Bold (), 10-point (10 ) |
Name | Label6 | |
Text | ||
Label7 | Font | Times New Roman, Bold (), 10-point (10 ) |
Name | Label7 | |
Text | ||
ComboBox1 | Items () | |
Name | ComboBox1 | |
ComboBox2 | Items () | |
Name | ComboBox2 | |
ListBox1 | Name | ListBox1 |
ListBox2 | Name | ListBox2 |
Text | ||
Button1 | Name | Button1 |
Text |
5.3) :
|
|
4.7.
5.4) :
. .1.7 -2.
Option Strict On Option Explicit On 'Imports System.Math Public Class 7 Dim x() As Single ' Sub vvod(ByRef x() As Single, ByVal index As Integer) Dim y, r As String Dim i As Integer Select Case index Case 0 ' For i = 0 To UBound(x) r = Str(i) y = InputBox(" X("+ r +")=", _ " X()") x(i) = CSng(Val(y)) Next i Case 1 ' . For i = 0 To UBound(x) x(i) = Rnd(1) * 10 - 5 Next i Case 2 ' For i = 0 To UBound(x) x(i) = i * 5 - 15 Next i End Select End Sub ' Public Sub PrintL(ByRef x() As Single,ByRef LB As ListBox) Dim i As Integer Dim y As String = " " For i = 0 To UBound(x) y = y + Format(x(i), "00.00") + Space(4) Next i y = y + "------" LB.Items.Add(y) End Sub ' - Public Sub sort1(ByRef x() As Single) Dim Box As Single Dim i, j As Integer For i = 0 To UBound(x) - 1 For j = i + 1 To UBound(x) If x(i) > x(j) Then Box = x(j): x(j) = x(i): x(i) = Box End If Next j Next i End Sub ' - Public Sub sort2(ByRef x() As Single) Dim i, j, m As Integer Dim xmax As Single For i = 0 To UBound(x) - 1 xmax = x(i): m = i For j = i + 1 To UBound(x) If x(j) > xmax Then xmax = x(j) m = j End If Next j x(m) = x(i) x(i) = xmax Next i End Sub ' - Public Sub mass_udal(ByRef x() As Single) Dim j, i, n As Integer n = UBound(x) i = 0 Do While i <= n If x(i) < 0 Then For j = i To n - 1 x(j) = x(j + 1) Next j n = n - 1 Else i = i + 1 End If Loop ReDim Preserve x(n) End Sub ' Private Sub Form1_Load(ByVal sender As System.Object,_ ByVal e As System.EventArgs) Handles MyBase.Load Label1.Text = "" + Space(3) + "" + _ Space(3) & " " Label2.Text = CStr(DateTime.Now) End Sub ' . ComboBox1 Private Sub ComboBox1_SelectedIndexChanged _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles ComboBox1.SelectedIndexChanged Dim index, n As Integer index = ComboBox1.SelectedIndex ' - - ComboBox1 ListBox1.Items.Clear() ListBox2.Items.Clear() n = CInt(TextBox1.Text) '= - ReDim x(n) vvod(x, index) ' PrintL(x, ListBox1) ' End Sub ' . ComboBox2 Private Sub ComboBox2_SelectedIndexChanged _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles _ ComboBox2.SelectedIndexChanged Dim ind As Integer ind = ComboBox2.SelectedIndex ListBox2.Items.Clear() Select Case ind Case 0 sort1(x) ' . . Case 1 sort2(x) ' . . Case 2 mass_udal(x) ' . . - End Select PrintL(x, ListBox2) ' . . End Sub Private Sub Button6_Click(ByVal sender As System.Object,_ ByVal e As System.EventArgs) Handles Button6.Click End End Sub End Class |
. 4.7.7. 7-1 :
6) :
. 4.7.7-3.
. 4.7.7-3. 7-1 :
7) :
8 : 2.06, 0.33, 0.80, -2.10, -1.98, 2.75, -4.86, 2.61, 3.14.
2.06, 0.33, 0.80, 2.75, 2.61, 3.14.
: , , , , , .
1) ?
2) ?
3) ?
4) , ?
5) ?
6) ?
7) ?
8) ?
9) ?
10) ?
11) ?
12) , ?
13) , ?
14) , ?
15) ?
16) ?
17) ?
18) ?
19) , , .
20) ?
21) ?
22) ?
23) , ?
24) ?
25) ListBox ComboBox?
26) ListBox?
27) ComboBox?
28) , ?
29) , ?
30) ?
31) ?
32) ?
33) ?
34) ?
35) Array ?
36) ?