Advertisement
kon9wa88

alphabet

Jun 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FORM1
  2. ___________________________________________________________________________________________________
  3. Public Class Form1
  4.  
  5.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  6.         Dim s1(5) As Module1.x, n As Integer
  7.         vvod(s1, n)
  8.         pech(s1, n, ListBox1)
  9.         alph(s1, n)
  10.         pech(s1, n, ListBox2)
  11.     End Sub
  12. End Class
  13. ___________________________________________________________________________________________________
  14.  
  15. MODULE
  16. ___________________________________________________________________________________________________
  17. Module Module1
  18.  
  19.     Public Structure x
  20.  
  21.         Public fam As String
  22.         Public gr As String
  23.         Public oc As String
  24.  
  25.         Public Sub vvodp()
  26.             fam = InputBox("fam")
  27.             gr = InputBox("gr")
  28.             oc = InputBox("ocenki")
  29.         End Sub
  30.  
  31.         Public Function stroka() As String
  32.             stroka = LSet(fam, 10) + LSet(Str(gr), 4) + LSet(Str(oc), 4)
  33.         End Function
  34.  
  35.     End Structure
  36.  
  37.     Public Sub alph(ByVal s() As x, ByVal n As Integer)
  38.         Dim i As Integer, ots As Boolean, buf As x
  39.         Do
  40.             ots = True
  41.             For i = 0 To n - 2
  42.                 If s(i).fam > s(i + 1).fam Then
  43.                     ots = False
  44.                     buf = s(i)
  45.                     s(i) = s(i + 1)
  46.                     s(i + 1) = buf
  47.                 End If
  48.             Next
  49.         Loop Until ots = True
  50.     End Sub
  51.  
  52.     Public Sub vvod(ByRef s() As x, ByRef n As Integer)
  53.         Dim i As Integer
  54.         n = Val(InputBox("Kol-vo stud"))
  55.         For i = 0 To n - 1
  56.             s(i).vvodp()
  57.         Next
  58.     End Sub
  59.  
  60.  
  61.     Public Sub pech(ByVal s() As x, ByVal n As Integer, ByRef lst1 As ListBox)
  62.         Dim i As Integer
  63.         For i = 0 To n - 1
  64.             lst1.Items.Add(s(i).stroka)
  65.         Next
  66.     End Sub
  67.  
  68.  
  69. End Module
  70. ___________________________________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement