Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Function mvvod(ByVal t As TextBox)
  4.         Return Val(t.Text)
  5.     End Function
  6.  
  7.     Function sa(ByVal x As Double)
  8.         Return (x ^ 3 - 6 * x ^ 2 + 19.8)
  9.     End Function
  10.  
  11.     Sub vivodlist(ByVal x As Double, ByVal l As ListBox)
  12.         l.Items.Add(Format(x, "00.0000"))
  13.     End Sub
  14.  
  15.     Sub vivod(ByVal x As Double, ByVal t As TextBox)
  16.         t.Text = CStr(x)
  17.     End Sub
  18.  
  19.     Sub tes(ByVal a As Double, ByVal b As Double, ByVal h As Double, ByRef pro As Double)
  20.         Dim x, y, n As Double
  21.  
  22.         n = Fix((b - a) / h) + 1
  23.         x = a
  24.         pro = 1
  25.  
  26.         For i = 1 To n
  27.             y = sa(x)
  28.             If (y > 1.2) Then
  29.                 pro = pro * y
  30.             End If
  31.  
  32.             vivodlist(x, ListBox1)
  33.             vivodlist(y, ListBox2)
  34.             x = x + h
  35.  
  36.         Next
  37.     End Sub
  38.  
  39.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  40.         Dim a, b, h, pro As Double
  41.  
  42.         a = mvvod(TextBox4)
  43.         b = mvvod(TextBox5)
  44.         h = mvvod(TextBox6)
  45.  
  46.         tes(a, b, h, pro)
  47.  
  48.         vivod(pro, TextBox7)
  49.  
  50.  
  51.     End Sub
  52. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement