0% found this document useful (0 votes)
28 views

Private Sub RECUPERAR - Click

The document describes code for a student record management system. It includes subroutines to: 1) Read student records from a file and store them in arrays. 2) Sort the student records alphabetically by last name. 3) Output to files the names of students who passed each subject and exam. 4) Output to a file the names of students who failed exams. 5) Search for a student by code and display their name. 6) Find the highest subject mark and associated student name. 7) Count the number of male and female students.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Private Sub RECUPERAR - Click

The document describes code for a student record management system. It includes subroutines to: 1) Read student records from a file and store them in arrays. 2) Sort the student records alphabetically by last name. 3) Output to files the names of students who passed each subject and exam. 4) Output to a file the names of students who failed exams. 5) Search for a student by code and display their name. 6) Find the highest subject mark and associated student name. 7) Count the number of male and female students.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Dim i, j, k, g, h, T, T1, T2, T3, T4, T5, pos, pos1, pos2, pos3, pos4, cond As Integer Dim aux,

aux1, aux2, aux3, aux4, aux5, aux6, aux7 As String Dim sis(2), sexo(2), PP(2), SP(2), EF(2), SI(2), nom(2), ape(2), prom(2) As String Dim X, X1, X2, X3, X4, X5, may As String Dim V(0 To 2) As String Private Sub RECUPERAR_Click() Open "d:\archi1.dad" For Input As #1 i = 0 Do While Not EOF(1) Input #1, V(i) i = i + 1 Loop Close #1 For j = 0 To i - 1 TT1.Text = TT1.Text & V(j) & Chr(13) & Chr(10) Next End Sub Private Sub ORDENAR_Click() For k = 0 To i - 1 X = V(k) T = Len(X) 'faltan trabajar los espacios sis(k) = Left(X, 8) 'codigo sis sexo(k) = Right(X, 1) 'el sexo de la persona X1 = Mid(X, 10, (T - 11)) 'nombre apellido y nota T1 = Len(X1) pos = InStr(X1, " ") ape(k) = Mid(X1, 1, pos - 1) X2 = Mid(X1, pos + 1, (T1 - pos)) T2 = Len(X2) pos1 = InStr(X2, " ") nom(k) = Mid(X2, 1, pos1 - 1) X3 = Mid(X2, pos1 + 1, (T2 - pos1)) T3 = Len(X3) pos2 = InStr(X3, " ") PP(k) = Mid(X3, 1, pos2 - 1) X4 = Mid(X3, pos2 + 1, (T3 - pos2)) T4 = Len(X4) pos3 = InStr(X4, " ") SP(k) = Mid(X4, 1, pos3 - 1) X5 = Mid(X4, pos3 + 1, (T4 - pos3)) T5 = Len(X5) pos4 = InStr(X5, " ") EF(k) = Mid(X5, 1, pos4 - 1) SI(k) = Mid(X5, pos4 + 1, (T5 - pos4)) Next For g = 0 To i - 2 For h = g + 1 To i - 1 If ape(g) > ape(h) Then aux = ape(g) ape(g) = ape(h) ape(h) = aux aux1 = nom(g) nom(g) = nom(h) nom(h) = aux1 aux2 = sis(g) sis(g) = sis(h) sis(h) = aux2 aux3 = sexo(g)

sexo(g) = sexo(h) sexo(h) = aux3 aux4 = PP(g) PP(g) = PP(h) PP(h) = aux4 aux5 = SP(g) SP(g) = SP(h) SP(h) = aux5 aux6 = EF(g) EF(g) = EF(h) EF(h) = aux6 aux7 = SI(g) SI(g) = SI(h) SI(h) = aux7 End If Next Next TT1.Text = "" For j = 0 To i - 1 TT1.Text = TT1.Text & ape(j) & " " & nom(j) & " " & sis(j) & " " & PP(j) & " " & SP(j) & " " & EF(j) & " " & SI(j) & " " & sexo(j) & Chr(13) & Chr(10) Next MsgBox ("El vector ya esta ordenado") End Sub Private Sub APROVADOS_Click() TT1.Text = "" Open "d:\aprobat1.dad" For Output As #3 For j = 0 To i - 1 prom(j) = PP(j) / 2 + SP(j) / 2 If prom(j) >= 51 Then TT1.Text = TT1.Text & ape(j) & " " & nom(j) & " " & prom(j) & Chr(13) & Chr(10) Print #3, ape(j), nom(j), prom(j) End If If EF(j) >= 51 Then TT1.Text = TT1.Text & ape(j) & " " & nom(j) & " " & EF(j) & Chr(13) & Chr(10) Print #3, ape(j), nom(j), EF(j) End If If SI(j) >= 51 Then TT1.Text = TT1.Text & ape(j) & " " & nom(j) & " " & SI(j) & Chr(13) & Chr(10) Print #3, ape(j), nom(j), SI(j) End If Next Close #3 End Sub Private Sub REPROVADOS_Click() TT1.Text = "" Open "d:\reprobat1.dad" For Output As #4 For j = 0 To i - 1 prom(j) = PP(j) / 2 + SP(j) / 2 If prom(j) >= 51 Then If EF(j) >= 51 Then If SI(j) >= 51 Then Else TT1.Text = TT1.Text & ape(j) & " " & nom(j) & " " & SI(j) & Chr(13) & Chr(10) Print #4, ape(j), nom(j), SI(j) End If End If End If

Next Close #4 End Sub Private Sub BUSCARCODIGO_Click() X = cod.Text pos = -1 For j = 0 To i - 1 If sis(j) = X Then pos = j End If Next If pos >= 0 Then dad.Text = nom(pos) & " " & ape(pos) Else dad.Text = "no existe" End If End Sub Private Sub MAYORNOTA_Click() may = 51 For j = 0 To i - 1 If SP(j) > may Then may = SP(j) pos = j Else MsgBox ("esta es la mayor nota") End If Next dad.Text = may & " " & ape(pos) & " " & nom(pos) End Sub Private Sub NUMDAMAS_Click() cond = 0 For j = 0 To i - 1 If sexo(j) = "F" Then cond = cond + 1 End If Next SEX.Text = cond End Sub Private Sub NUMVARONES_Click() cond = 0 For j = 0 To i - 1 If sexo(j) = "M" Then cond = cond + 1 End If Next SEX.Text = cond End Sub Private Sub UserForm_Click() dad.Text = "" SEX.Text = "" End Sub

You might also like