Материал: posobie_po_informatike_Chast1_Word

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

Оборудование, инструменты и приборы

ПЭВМ, программное обеспечение Microsoft Office (Excel 2007).

Варианты заданий

Найти ошибки и выполнить отладку программы, выданной преподавателем, согласно варианту заданий, приведенных в таблице 3.7.

Таблица 3.7

Варианты заданий

№

варианта

Задание

1

2

Синтакситеческие ошибки

1

Private Sub Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsqBox"Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение таблицы 3.7

1

2

2

Private Sub Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox"Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Analiz a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение таблицы 3.7

1

2

3

Private Sub Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Elze

If x < y Then 'Вложенный оператор

r = y

Elze

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение таблицы 3.7

1

2

4

Private Sub Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Tnen

r = x

Else

If x < y Tnen 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

5

Private Sub Анализ(BiVal x As Integer, BiVal y As Integer, _

BiRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

6

Privat Sub Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

7

Private Sab Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sab

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

8

Private Sub Анализ(ByVal x As Inteqer, ByVal y As Inteqer, _

ByRef r As Inteqer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Inteqer, b As Inteqer, maximum2 As Inteqer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

9

Private Sub Анализ(ByVal x As Integer, ByVal y As Integer,

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

10

Private Sub Analiz(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CInt(Text1.Text)

b = CInt(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

11

Private Sub Анализ(ByVal x As Integer, ByVal y As Integer, _

ByRef r As Integer)

If x > y Then

r = x

Else

If x < y Then 'Вложенный оператор

r = y

Else

MsgBox "Числа равные" 'Блок из 2-х операторов

r = x

End If

End If

End Sub

Private Sub CmdРешение_Click()

Dim a As Integer, b As Integer, maximum2 As Integer

a = CIht(Text1.Text)

b = CIht(Text2.Text)

Анализ a, b, maximum2

Text3.Text = maximum2

End Sub

Продолжение табл. 3.7

1

2

12

Private Sub Реш_квадр_ур_Click()

Dim a As Integer, b As Integer, c As Integer, _

d As Single, x1 As Single, x2 As Single

a = CInt(TextBox1.Text): b = CInt(TextBox2.Text): c = CInt(TextBox3.Text)

d = b ^ 2 - 4 * a * c

If d < 0 Then

MsgBox "Нет веществ-х корней"

Else

If d = 0 Then

x1 = -b / (2 * a): x2 = x1

TextBox4.Text = x1: TextBox5.Text = x2

Else

x1 = (-b - Sqr(d)) / (2 * a): x2 = (-b + Sqr(d)) / (2 * a)

TextBox4.Text = x1: TextBox5.Text = x2

End Sub

Источник: https://files.student-it.ru/previewfile/281619