Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Шпоры по задачам.docx
Скачиваний:
2
Добавлен:
27.10.2018
Размер:
37.36 Кб
Скачать

27. Усеч. Четырехугольная пирамида.

Imports System

Imports System.Windows.Forms

Imports System.Drawing

Imports System.IO

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

Dim x, y, a As Integer

Dim pB4 As Graphics

pB4 = PictureBox1.CreateGraphics()

x = Val(TextBox1.Text)

y = Val(TextBox2.Text)

a = Val(TextBox3.Text)

pB4.DrawLine(Pens.Black, x, y, x + a, y)

pB4.DrawLine(Pens.Black, x, y, x + Convert.ToInt16(a / 4), y - Convert.ToInt16(a / 2))

pB4.DrawLine(Pens.Black, x + a, y, x + a - Convert.ToInt16(a / 4), y - Convert.ToInt16(a / 2))

pB4.DrawLine(Pens.Black, x + Convert.ToInt16(a / 4), y - Convert.ToInt16(a / 2), x + a - Convert.ToInt16(a / 4), y - Convert.ToInt16(a / 2))

End Sub

40. 6 Призеров и победитель.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim r(10) As Integer

Dim f(10) As Integer

Dim i, j, b, imax As Integer

For i = 1 To 10

f(i) = i

r(i) = Int(Rnd() * 100)

ListBox1.Items.Add(Convert.ToString(f(i)) & " - " & Convert.ToString(r(i)))

Next

For i = 1 To 7

imax = i

For j = i + 1 To 10

If r(j) > r(imax) Then

imax = j

End If

Next

b = r(i)

r(i) = r(imax)

r(imax) = b

b = f(i)

f(i) = f(imax)

f(imax) = b

ListBox2.Items.Add(Convert.ToString(f(i)) & " - " & Convert.ToString(r(i)))

Next

End Sub

39. Первый + второй = третий массивы.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim a(5) As Integer

Dim b(5) As Integer

Dim c(10) As Integer

Dim i, j, baf, imax As Integer

For i = 1 To 5

a(i) = Int(Rnd() * 100)

b(i) = Int(Rnd() * 100)

ListBox1.Items.Add(Convert.ToString(a(i)) & " - " & Convert.ToString(b(i)))

Next

For i = 1 To 5

c(i) = a(i)

Next

For i = 6 To 10

c(i) = b(i - 5)

Next

For i = 1 To 9

imax = i

For j = i + 1 To 10

If c(j) < c(imax) Then

imax = j

End If

Next

baf = c(i)

c(i) = c(imax)

c(imax) = baf

ListBox2.Items.Add(Convert.ToString(c(i)))

Next

ListBox2.Items.Add(Convert.ToString(c(10)))

End Sub

38. Разложение экспоненты.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim mye, p As Double

Dim n, i As Integer

mye = 2

p = 1

n = Convert.ToInt16(TextBox1.Text)

For i = 2 To n

p = p * i

mye = mye + 1 / p

Next

ListBox1.Items.Add(Convert.ToString(mye))

End Sub

35. Мяч.

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

Dim a, b, p, h, k As Integer

Dim th As Double

a = Convert.ToInt16(TextBox1.Text)

b = Convert.ToInt16(TextBox2.Text)

h = Convert.ToInt16(TextBox3.Text)

p = Convert.ToInt16(TextBox4.Text)

k = 0

th = h

Do

k = k + 1

th = th * a / b

Loop While th >= p

ListBox2.Items.Add(Convert.ToString(k))

MessageBox.Show(Convert.ToString(k))

End Sub

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Оставленные комментарии видны всем.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]