Pracica De Programacion
´VALORES MÁXIMO Y MÍNIMO DE UN VECTOR
Dim vector ( ) as Integer
Dim TamanoVector As Integer
Dim indice, Max, Min As Integer
Private Sub BtnEntrada_Click()
If indice Max) Then Max =vector(indice)
Next
For indice = 1 To TamanoVector
If (vector(indice) < Min) Then Min = vector(indice)
Next
Maximo.Visible = True
Minimo.Visible = True
BtnEntrada.Enabled = Falseentrada.Enabled = False
End If
End Sub
Private Sub tamano_Change()
entrada.Enabled = True
BtnEntrada.Enabled = True
tamano.Enabled = False
CadenaVector.Visible = TrueTamanoVector = Val(tamano.Text)
indice = 1
End Sub
[pic]
[pic]
‘ANALIZA SI UN NÚMERO ES NEGATIVO, POSITIVO, ENTERO, REAL,
‘PAR, O IMPAR
Dim n, a As Single
Private Sub CommandButton1_Click()
n= Val(InputBox("introduzca un número", "número"))
TextBox2.Visible = True
If n < 0 Then
TextBox2.Text = "El número " & Str(n) & " es " & "negativo"
n = n * (-1)
Else
TextBox2.Text = "Elnúmero " & Str(n) & " es " & "positivo"
End If
a = n
While a > 0
a = a - 1
Wend
If a = 0 Then
TextBox2.Text = TextBox2.Text & " entero"
Else
TextBox2.Text = TextBox2.Text & " real"
End IfIf n Mod 2 = 0 Then
TextBox2.Text = TextBox2.Text & " par"
Else
TextBox2.Text = TextBox2.Text & " impar"
End If
End Sub
[pic]
`INTEGRACIÓN
Dim a, b, n, xi, h, yi, e, suma, i, Int AsSingle
Private Sub CommandButton1_Click()
a = 0
b = 1
n = Val(TextBox1.Text)
h = 1 / n
e = 2.71828182
For i = 1 To i 0
A = Val(InputBox("introduzca otro valor de a"))
TextBox1.Text = Str(A)b = Val(InputBox("introduzca otro valor de b"))
TextBox2.Text = Str(b)
fa = (A ^ 3) + ((A ^ 2) * Sin(A)) + (e ^ A * A) + 7
fb = (b ^ 3) + ((b ^ 2) * Sin(b)) + (e ^ b * b) + 7
Loop
N =Val(TextBox3.Text)
i = 1
p = (A + b) / 2
fp = (p ^ 3) + ((p ^ 2) * Sin(p)) + (e ^ p * p) + 7
Do While i 0 Then
A = p
Else
b = p
End If
p = (A + b) / 2
If Abs(fp) > 10 ^ -8 Then
i = i + 1
Else...
Regístrate para leer el documento completo.