Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Imports System.Math
  2. Public Class Form1
  3.  
  4. Dim stupanj As Integer = 0
  5. Dim vrijednost As Double = 0
  6.  
  7. Private Sub stupanj_tbox_TextChanged(sender As Object, e As EventArgs) Handles stupanj_tbox.TextChanged
  8. stupanj = stupanj_tbox.Text
  9. koef_listbox.Items.Clear()
  10. koef_label.Text = "Koeficijent a" & koef_listbox.Items.Count
  11. vrijednost_listbox.Items.Clear()
  12. End Sub
  13.  
  14. Private Sub upisi_button_Click(sender As Object, e As EventArgs) Handles upisi_button.Click
  15. If koef_listbox.Items.Count <= stupanj Then
  16. koef_listbox.Items.Add(CInt(koef_tbox.Text))
  17. koef_tbox.Text = ""
  18. koef_tbox.Focus()
  19.  
  20. koef_label.Text = "Koeficijent a" & koef_listbox.Items.Count
  21. Else
  22. For x As Integer = -5 To 5
  23. For k As Integer = 0 To stupanj
  24. vrijednost += koef_listbox.Items(k) * Pow(x, k)
  25. Next
  26. vrijednost_listbox.Items.Add(vrijednost)
  27. vrijednost = 0
  28. Next
  29. End If
  30. End Sub
  31. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement