Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.02 KB | None | 0 0
  1. Imports System.Math
  2. Public Class Form1
  3.  
  4.     Function mvvod(ByVal T As TextBox) As Double
  5.         Return Val(T.Text)
  6.     End Function
  7.  
  8.     Sub vivodList(ByVal x As Double, ByVal LB As ListBox)
  9.         LB.Items.Add(Format(x, "00.0000"))
  10.     End Sub
  11.  
  12.     Sub ser(ByVal a As Double, ByVal b As Double, ByVal h As Double)
  13.         Dim z, n, x As Double
  14.  
  15.         n = CInt(Fix(b - a) / h) + 1
  16.         x = a
  17.  
  18.         For i = 1 To n
  19.             If x >= 0 And x <= 5 Then
  20.                 z = 5 * Exp(x)
  21.             ElseIf x > 5 Then
  22.                 z = 2 * Sin(x)
  23.             ElseIf x < 0 Then
  24.                 z = Abs(x)
  25.             End If
  26.  
  27.             vivodList(x, ListBox1)
  28.             vivodList(z, ListBox2)
  29.             x = x + h
  30.  
  31.  
  32.         Next
  33.     End Sub
  34.  
  35.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  36.         Dim a, b, h As Double
  37.  
  38.         a = mvvod(TextBox4)
  39.         b = mvvod(TextBox5)
  40.         h = mvvod(TextBox6)
  41.  
  42.         ser(a, b, h)
  43.  
  44.     End Sub
  45. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement