Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Sbornik_zadach_-mogut_prigoditsya_pri_sdache_ek...docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
714.03 Кб
Скачать

35. Максимальная высота подъема

Private Sub Command1_Click()

Dim v As Double

Dim al As Double

Dim h As Double

Text3.Text = ""

v = Val(Text1.Text)

al = Val(Text2.Text)

al = al * 3.14159 / 180

h = (v ^ 2 * Sin(al) ^ 2) / (2 * 9.8)

Text3.Text = " h = " + Str(Round(h, 5))

End Sub

Private Sub Command2_Click()

End

End Sub

36. Треугольник, площадь и радиус окружности.

Option Explicit

Dim a As Integer, b As Integer, c As Integer, p As Double, s As String, r As String, PushButton As Long

Private Sub Command1_Click()

If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then

PushButton = MsgBox("Неверные данные", 48, "Ошибка")

If PushButton = vbOK Then Text1.Text = "": Text2.Text = "": Text3.Text = "": Label4.Caption = "": Label5.Caption = ""

Else

If Text1.Text = 0 Or Text2.Text = 0 Or Text3.Text = 0 Then

PushButton = MsgBox("Неверные данные", 48, "Ошибка")

If PushButton = vbOK Then Text1.Text = "": Text2.Text = "": Text3.Text = "": Label4.Caption = "": Label5.Caption = ""

Else

a = Text1.Text: b = Text2.Text: c = Text3.Text

If a + b > c And a + c > b And b + c > a Then

Label4.Caption = "s=": Label5.Caption = "r="

p = (a + b + c) / 2

s = Sqr(p * (p - a) * (p - b) * (p - c))

s = Int(s * 100) / 100

Label4.Caption = Label4.Caption + s

r = Sqr(((p - a) * (p - b) * (p - c)) / p)

r = Int(r * 100) / 100

Label5.Caption = Label5.Caption + r

Else

PushButton = MsgBox("Такого треугольника не существует", 48, "Ошибка"): Label4.Caption = "": Label5.Caption = ""

If PushButton = vbOK Then Text1.Text = "": Text2.Text = "": Text3.Text = ""

End If

End If

End If

End Sub

37. Арифметические действия. Возвести в степень, н факториал

Option Explicit

Private Sub Command1_Click()

Dim n As Integer, i As Integer, p As String, k As Integer, s As String, e As String, x As String, z As String

n = Text1.Text

p = 1

For i = 1 To n

p = p * 2

Next i

Label5.Caption = p

k = Text2.Text

s = 1

For i = 1 To k

s = s * i

Next i

Label6.Caption = s

e = 1

z = 1

x = 1

Do While x > 0.0001

x = e

e = e + 1 / z

z = z * (z + 1)

x = e - x

Loop

Label7.Caption = e

End Sub

38. Блокнот

Option Explicit

Private Sub mnuBackColor_Click()

CDlg1.ShowColor

Text1.BackColor = CDlg1.Color

End Sub

Private Sub mnuEditCopy_Click()

Clipboard.Clear

Clipboard.SetText Form1.Text1.SelText

End Sub

Private Sub mnuEditCut_Click()

Clipboard.Clear

Clipboard.SetText Form1.Text1.SelText

Form1.Text1.SelText = ""

End Sub

Private Sub mnuEditPaste_click()

Form1.Text1.SelText = Clipboard.GetText()

End Sub

Private Sub mnuEditDel_Click()

Form1.Text1.SelText = ""

End Sub

Private Sub mnuFontBold_Click()

CDlg1.ShowFont

Text1.Font.Size = CDlg1.FontSize

Text1.Font.Name = CDlg1.FontName

Text1.Font.Bold = CDlg1.FontBold

Text1.Font.Italic = CDlg1.FontItalic

Text1.Font.Underline = CDlg1.FontUnderline

End Sub

Private Sub mnuFontColor_Click()

CDlg1.ShowColor

Text1.SelColor = CDlg1.Color

End Sub

Private Sub Timer1_Timer()

Text1.Width = Form1.ScaleWidth

Text1.Height = Form1.ScaleHeight - Toolbar1.Height

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case Is = "Copy"

Clipboard.Clear

Clipboard.SetText Form1.Text1.SelText

Case Is = "Cut"

Clipboard.Clear

Clipboard.SetText Form1.Text1.SelText

Form1.Text1.SelText = ""

Case Is = "Paste"

Form1.Text1.SelText = Clipboard.GetText()

Case Is = "Del"

Form1.Text1.SelText = ""

End Select

End Sub

Private Sub mnuFileOpen_Click()

CDlg1.ShowOpen

Text1.LoadFile CDlg1.FileName

End Sub

Private Sub mnuFileSave_Click()

If CDlg1.FileName = "" Then

mnuFileSaveAs_click

Else

Text1.SaveFile CDlg1.FileName

End If

End Sub

Private Sub mnuFileSaveAs_click()

CDlg1.ShowSave

Text1.SaveFile CDlg1.FileName

End Sub

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