PROGRAMA

9
1. Hacer un programa que guarde: nombre, edad, sexo, notas,correo; con arreglos. 2. Un programa q ordene edades, notas, sexo y nombre; y debe imprimir el nombre con nota, el sexo y edad. Por ejem. :"MARIA ,FEMININA TIENE 30 AÑOS Y SU NOTA ES 60" 16:00 Mabel Tolaba Lopez 3.Un programa con las mismas variables del segundo, pero q nos de la nota mas alta CON EL NOMBRE, SEXO, SU PROMEDIO, DE APROBACIÓN O REPROBACIÓN. 16:06 Mabel Tolaba Lopez 4. Debemos realizar un programa para q funcione el sistema binario de encendido apagado de las velitas o de focos, es decir cuando encendemos algunos focos nos da la suma de los numeros binarios y la suma de numeros naturales.

description

computacion para ingenieira

Transcript of PROGRAMA

1. Hacer un programa que guarde: nombre, edad, sexo, notas,correo; con arreglos.2. Un programa q ordene edades, notas, sexo y nombre; y debe imprimir el nombre con nota, el sexo y edad. Por ejem. :"MARIA ,FEMININA TIENE 30 AOS Y SU NOTA ES 60" 16:00Mabel Tolaba Lopez3.Un programa con las mismas variables del segundo, pero q nos de la nota mas alta CON EL NOMBRE, SEXO, SU PROMEDIO, DE APROBACIN O REPROBACIN. 16:06Mabel Tolaba Lopez4. Debemos realizar un programa para q funcione el sistema binario de encendido apagado de las velitas o de focos, es decir cuando encendemos algunos focos nos da la suma de los numeros binarios y la suma de numeros naturales.

CODIFICACION Dim c As IntegerDim V(1 To 10000) As StringPrivate Sub Command1_Click()Dim nom As StringDim edad As StringDim sexo As StringDim correo As StringDim nota As Stringnom = Text1.Textedad = Text2.Textsexo = Text3.Textnota = Text4.Textcorreo = Text5.Textc = c + 1V(c) = nom & " " & edad & " " & sexo & " " & nota & " " & correoText1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""End Sub

Private Sub Command2_Click()List1.ClearFor i = 1 To c Step 1List1.AddItem (V(i))Next iEnd Sub

Private Sub Command3_Click()Dim nom1 As StringDim nom2 As StringDim aux As StringDim i As IntegerDim j As IntegerList2.ClearFor i = 1 To c - 1 Step 1 nom1 = nombre(V(i)) For j = i + 1 To c Step 1 nom2 = nombre(V(j)) If (nom1 > nom2) Then aux = V(i) V(i) = V(j) V(j) = aux End If Next jNext iFor i = 1 To c Step 1 List2.AddItem (V(i))Next iEnd Sub

Private Sub Command4_Click()Dim eda1 As StringDim eda2 As StringDim aux As StringDim i As IntegerDim j As IntegerList2.ClearFor i = 1 To c - 1 Step 1 eda1 = edad(V(i)) For j = i + 1 To c Step 1 eda2 = edad(V(j)) If (eda1 > eda2) Then aux = V(i) V(i) = V(j) V(j) = aux End If Next jNext iFor i = 1 To c Step 1 List2.AddItem (V(i))Next iEnd Sub

Private Sub Command5_Click()Dim sex1 As StringDim sex2 As StringDim aux As StringDim i As IntegerDim j As IntegerList2.ClearFor i = 1 To c - 1 Step 1 sex1 = sexo(V(i)) For j = i + 1 To c Step 1 sex2 = sexo(V(j)) If (sex1 > sex2) Then aux = V(i) V(i) = V(j) V(j) = aux End If Next jNext iFor i = 1 To c Step 1 List2.AddItem (V(i))Next iEnd Sub

Private Sub Command6_Click()Dim not1 As StringDim not2 As StringDim aux As StringDim i As IntegerDim j As IntegerList2.ClearFor i = 1 To c - 1 Step 1 not1 = nota(V(i)) For j = i + 1 To c Step 1 not2 = nota(V(j)) If (not1 > not2) Then aux = V(i) V(i) = V(j) V(j) = aux End If Next jNext iFor i = 1 To c Step 1 List2.AddItem (V(i))Next iEnd SubPrivate Sub Command7_Click()Dim nom As StringDim i As IntegerDim Nm As StringDim sex As StringDim eda As StringDim not1 As StringNm = InputBox("INTRODUSCA EL NOMBRE DE LA PERSONA QUE QUIERE BUSCAR")For i = 1 To c Step 1 nom = nombre(V(i)) If (nom = Nm) Then sex = sexo(V(i)) eda = edad(V(i)) not1 = nota(V(i)) Text6.Text = nom Text7.Text = sex Text8.Text = eda Text9.Text = not1 End IfNext iEnd Sub

Function nombre(x As String) As String ' en x se encuentra toda la cadena de la cual se esta capturando la nombreDim E1 As IntegerE1 = InStr(x, " ")nom = Left(x, E1 - 1)nombre = nomEnd Function

Function edad(x As String) As String ' en x se encuentra toda la cadena de la cual se esta capturando la edadDim E1 As IntegerDim E2 As IntegerE1 = InStr(x, " ")E2 = InStr(E1 + 1, x, " ")edad = Mid(x, E1 + 1, E2 - E1 - 1)End Function

Function sexo(x As String) As String ' en x se encuentra toda la cadena de la cual se esta capturando la sexoDim E1 As IntegerDim E2 As IntegerDim E3 As IntegerE1 = InStr(x, " ")E2 = InStr(E1 + 1, x, " ")E3 = InStr(E2 + 1, x, " ")sexo = Mid(x, E2 + 1, E3 - E2 - 1)End Function

Function nota(x As String) As String ' en x se encuentra toda la cadena de la cual se esta capturando la notaDim E1 As IntegerDim E2 As IntegerDim E3 As IntegerDim E4 As IntegerE1 = InStr(x, " ")E2 = InStr(E1 + 1, x, " ")E3 = InStr(E2 + 1, x, " ")E4 = InStr(E3 + 1, x, " ")nota = Mid(x, E3 + 1, E4 - E3 - 1)End Function