Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Module Module1
Dim n1, n2, suma As Single
Sub Main()
Console.Write("ingrese primer numero ")
n1 = Console.ReadLine
Console.Write("ingrese primer numero ")
n2 = Console.ReadLine
suma = n1 + n2
Console.Write("la suma es {0} ", suma)
Console.ReadLine()
End Sub
End Module
Turno 1
Module Module1
Dim n1, n2, suma As Single
Sub Main()
Console.Write("ingrese Nro 1")
n1 = Console.ReadLine
Console.Write("ingrese Nro 2")
n2 = Console.ReadLine
suma = n1 + n2
Console.WriteLine("la suma es {0}", suma)
Console.ReadLine()
End Sub
End Module
En modo formulario
btnResta.Click, btnMultiplicar.Click
n1 = txtN1.Text
n2 = txtN2.Text
Select Case sender.text
Case "+" : resultado = n1 + n2
Case "-" : resultado = n1 - n2
Case "X" : resultado = n1 * n2
End Select
txtRes.Text = resultado
End Sub
End Class
Con funciones
Public Class Form1
Dim n1, n2, resultado As Single
Function SUMAR(N1 As Single, N2 As Single) As Single
Return N1 + N2
' SUMAR = N1 + N2
End Function
Function RESTAR(N1 As Single, N2 As Single) As Single
RESTAR = N1 - N2
End Function
Private Sub sumar(sender As Object, e As EventArgs) Handles btnSuma.Click,
btnResta.Click, btnMultiplicar.Click, btnSeno.Click
n1 = txtN1.Text
n2 = txtN2.Text
Select Case sender.text
Case "+" : resultado = SUMAR(n1, n2)
Case "-" : resultado = RESTAR(n1, n2)
Case "X" : resultado = n1 * n2
Case "SENO" : resultado = Math.Sin(n1)
End Select
txtRes.Text = resultado
End Sub
End Class
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -3
Module Module1
Dim n1, n2, suma As Single
Sub Main()
Console.Write("ingrese n1")
n1 = Console.ReadLine
Console.Write("ingrese n2")
n2 = Console.ReadLine
suma = n1 + n2
Console.WriteLine(" la suma es {0}", suma)
Console.ReadLine()
End Sub
End Module
Module Module1
Dim n1, n2 As Single
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -6
Sub Main()
Console.Write("ingrese n1 ")
n1 = Console.ReadLine
Console.Write("ingrese n2 ")
n2 = Console.ReadLine
Console.WriteLine(" la suma es {0}", n1 + n2)
Console.WriteLine(" la resta es {0}", n1 - n2)
Console.WriteLine(" LA POTENCIA DE {0} A {1} ES {2}", n1, n2, Math.Pow(n1, n2))
Console.ReadLine()
End Sub
End Module
Module Module1
Dim n1, n2 As Single
Sub Main()
Console.Write("ingrese n1 ")
n1 = Console.ReadLine
Console.Write("ingrese n2 ")
n2 = Console.ReadLine
Console.WriteLine(" la suma es {0}", n1 + n2)
Console.WriteLine(" la resta es {0}", n1 - n2)
Console.ForegroundColor = 10
Console.WriteLine(" LA POTENCIA DE {0} A {1} ES {2}", n1, n2, Math.Pow(n1, n2))
Console.WriteLine(" la FECHA ES {0}", Date.Now)
Console.WriteLine(" LA HORAS {0}", Date.Now.Hour)
Console.ForegroundColor = ConsoleColor.Red
Console.WriteLine("MINUTOS {0}", Date.Now.Minute)
Console.SetCursorPosition(40, 20)
Console.Write("EPII")
Console.ReadLine()
End Sub
End Module
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -7
Imports System.IO
Module Module1
Sub Main()
Dim archivo As StreamWriter
archivo = New StreamWriter("f:\DATOS\NOTAS.txt")
archivo.WriteLine("HOLA MUNDO")
archivo.Close()
Console.WriteLine(" archivo grabado satisfactoriamente")
Console.ReadLine()
End Sub
End Module
Module Module1
Sub Main()
Dim fila, col As Integer
For fila = 1 To 12
For col = 1 To 12
Console.Write("{0}{1}", fila * col, vbTab)
Next
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
Con archivos
Imports System.IO
Module Module1
Sub Main()
Dim archivo As StreamWriter
archivo = New StreamWriter("f:\datos\tablamult.txt")
Dim fila, col As Integer
For fila = 1 To 12
For col = 1 To 12
Console.Write("{0}{1}", fila * col, vbTab)
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -9
Module Module1
Sub MAIN()
Dim Fila, col As Integer
Dim prom, suma As Single
RecuperarMatriz(NombreArchivo, A, nfilas, ncol)
MostrarMatriz(A, nfilas, ncol)
For Fila = 0 To nfilas - 1
suma = 0
For col = 0 To ncol - 1
suma = suma + A(Fila, col)
Next
prom = suma / ncol
Console.WriteLine("prom {0} es {1}", Fila, prom)
Next
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module2
Public NombreArchivo As String = "F:\datos\notas2.txt"
Public Const limite As Integer = 10
Public A(limite, limite) As Integer
Public nfilas, ncol As Integer
Function ContarLetra(Cadena As String, letra As Char)
Dim LARGO As Integer = Len(Cadena)
Dim cont, cant As Integer
For cont = 0 To LARGO - 1
If Cadena(cont) = letra Then
cant = cant + 1
End If
Next
Return cant
End Function
Imports System.IO
Module Module1
Sub Main()
Dim Archivo As StreamWriter
Archivo = New StreamWriter("F:\DATOS\PRUEBA.TXT")
Console.WriteLine(" HOLA MUNDO")
Archivo.WriteLine(" HOLA MUNDO")
Archivo.Close()
Console.ReadLine()
End Sub
End Module
Ejercicio 2
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -13
Module Module1
Sub PROMEDIOS(A(,) As Integer, NF As Integer, NC As Integer)
Dim FILA, COL As Integer
Dim suma As Single
For FILA = 0 To NF - 1
suma = 0
For COL = 0 To NC - 1
suma = suma + A(FILA, COL)
Next
Console.WriteLine("{0} {1}", FILA, suma / NC)
Next
End Sub
Sub MAIN()
RecuperarMatriz(NombreArchivo, A, nfilas, ncol)
MostrarMatriz(A, nfilas, ncol)
Console.WriteLine("promedios")
PROMEDIOS(A, nfilas, ncol)
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module2
Public NombreArchivo As String = "F:\datos\matriz.txt"
Public Const limite As Integer = 120
Public A(limite, limite) As Integer
Public nfilas, ncol As Integer
Function ContarLetra(Cadena As String, letra As Char)
Dim LARGO As Integer = Len(Cadena)
Dim cont, cant As Integer
For cont = 0 To LARGO - 1
If Cadena(cont) = letra Then
cant = cant + 1
End If
Next
Return cant
End Function
nc = ContarLetra(cadena, vbTab) + 1
Do While Not (cadena = "")
cadena = cadena & vbTab
inicio = 1
For col = 0 To nc - 1
pos = InStr(inicio, cadena, Chr(9))
subcadena = Mid(cadena, inicio, pos - inicio)
A(fila, col) = Val(subcadena)
inicio = pos + 1
Next
fila = fila + 1
cadena = srLector.ReadLine()
Loop
nf = fila
Console.WriteLine("Archivo leido satisfactoriamente")
srLector.Close()
End Sub
Sub VerMatriz(ByVal A(,) As Integer, ByVal nf As Integer, ByVal nc As Integer, ByVal
cx As Integer, ByVal cy As Integer)
Dim fila, col, c1 As Integer
For fila = 0 To nf - 1
For col = 0 To nc - 1
If A(fila, col) <= 15 Then
Console.SetCursorPosition(cx + col, cy + fila)
Console.BackgroundColor = CType(A(fila, col), ConsoleColor)
Console.ForegroundColor = CType(A(fila, col), ConsoleColor)
Console.Write("{0}", A(fila, col))
End If
Next
Next
End Sub
Sub MostrarMatriz(A(,) As Integer, nf As Integer, nc As Integer)
Dim fila, col As Integer
For fila = 0 To nf - 1
For col = 0 To nc - 1
Console.Write("{0} {1}", A(fila, col), vbTab)
Next
Console.WriteLine()
Next
End Sub
End Module
Module Module1
Sub Main()
Console.WriteLine("HOLA MUNDO")
Console.ReadLine()
End Sub
End Module
Con archivos
Imports System.IO
Module Module1
Sub Main()
Dim Archivo As StreamWriter
Archivo = New StreamWriter("f:\datos\prueba.txt")
Console.WriteLine("HOLA MUNDO")
Archivo.WriteLine("HOLA MUNDO")
Archivo.Close()
Console.WriteLine("el archivo ha sido grabado")
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module1
Function f(x As Single, y As Single) As Single
'f = Math.Sin(x * x + y * y) / (x * x + y * y)
f = Math.Sin(x + y)
'Return Math.Sin(x * x + y * y) / x * x + y * y
End Function
Sub Main()
Dim x, y As Single
Dim Archivo As StreamWriter
Archivo = New StreamWriter("f:\datos\funcion3d.txt")
Console.WriteLine("valor de f(x,y)")
Archivo.WriteLine("valor de f(x,y)")
For y = -4 To 4 Step 0.5
For x = -4 To 4 Step 0.5
Console.Write("{0}{1}", f(x, y), vbTab)
Archivo.Write("{0}{1}", f(x, y), vbTab)
Next
Console.WriteLine()
Archivo.WriteLine()
Next
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -16
Archivo.Close()
Console.WriteLine("el archivo ha sido grabado")
Console.ReadLine()
End Sub
End Module
Module Module1
Sub PROMEDIOS(A(,) As Integer, NF As Integer, NC As Integer)
Dim FILA, COL As Integer
Dim suma As Single
For FILA = 0 To NF - 1
suma = 0
For COL = 0 To NC - 1
suma = suma + A(FILA, COL)
Next
Console.WriteLine("{0} {1}", FILA, suma / NC)
Next
End Sub
Sub MAIN()
RecuperarMatriz(NombreArchivo, A, nfilas, ncol)
MostrarMatriz(A, nfilas, ncol)
Console.WriteLine()
PROMEDIOS(A, nfilas, ncol)
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module2
Public NombreArchivo As String = "F:\datos\matriz.txt"
Public Const limite As Integer = 120
Public A(limite, limite) As Integer
Public nfilas, ncol As Integer
Function ContarLetra(Cadena As String, letra As Char)
Dim LARGO As Integer = Len(Cadena)
Dim cont, cant As Integer
For cont = 0 To LARGO - 1
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -17
Module Module1
Dim N1, N2,SUMA As Single
Sub Main()
Console.Write("INGRESE NRO 1 ")
N1 = Console.ReadLine
Console.Write("INGRESE NRO 2 ")
N2 = Console.ReadLine
SUMA=N1+N2
Console.WriteLine("LA SUMA DE {0} + {1} ES ={2} ", N1, N1, SUMA)
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module1
Dim N1, N2, SUMA As Single
Sub Main()
Dim Archivo As StreamWriter
Archivo = New StreamWriter("f:\datos\prueba.txt")
Console.Write("INGRESE NRO 1 ")
N1 = Console.ReadLine
Console.Write("INGRESE NRO 2 ")
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -19
N2 = Console.ReadLine
SUMA = N1 + N2
Console.WriteLine("LA SUMA DE {0} + {1} ES ={2} ", N1, N2, SUMA)
Archivo.WriteLine("LA SUMA DE {0} + {1} ES ={2} ", N1, N2, SUMA)
Archivo.Close()
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module1
Function F(x As Single, y As Single) As Single
F = Math.Sin(x * x + y * y) / (x * x + y * y)
' Return Math.Sin(x * x + y * y) / (x * x + y * y)
End Function
Sub Main()
Dim x, y, z As Single
For y = -4 To 4 Step 0.5
For x = -4 To 4 Step 0.5
z = F(x, y)
Console.Write("{0}{1}", z, vbTab)
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -20
Next
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
Chart Title
1
0.5
0
-0.5 1
Series73
15
Series64
Series55
29
Series46
43
Series37
Series28
57
Series19
Series10
71 Series1
Imports System.IO
Module Module1
Function F(x As Single, y As Single) As Single
F = Math.Sin(x * x + y * y) / (x * x + y * y)
' Return Math.Sin(x * x + y * y) / (x * x + y * y)
End Function
Sub Main()
Dim archivo As StreamWriter
Dim nombrearchivo As String = "F:\datos\funcio3d.txt"
archivo = New StreamWriter(nombrearchivo)
Dim x, y, z As Single
For y = -4 To 4 Step 0.1
For x = -4 To 4 Step 0.1
z = F(x, y)
Console.Write("{0}{1}", z, vbTab)
archivo.Write("{0}{1}", z, vbTab)
Next
Console.WriteLine()
archivo.WriteLine()
Next
archivo.Close()
Console.ForegroundColor = 10
Console.WriteLine("el archivo {0} a sido grabado", nombrearchivo)
Console.ReadLine()
End Sub
End Module
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -21
CLASE CIRCULO
Public Class circulo
' campos
Private Radio1 As Single
Private Area1 As Single
' propiedades
Property Radio() As Single
Get
Radio = Radio1
'Return Radio1
End Get
Set(value As Single)
Radio1 = value
End Set
End Property
ReadOnly Property Area() As Single
Get
Area = Area1
'Return Radio1
End Get
End Property
Sub CalcularArea()
Area1 = Math.PI * Math.Pow(Radio1, 2)
End Sub
Sub New(Optional R = 10)
Radio1 = 10
End Sub
Protected Overrides Sub Finalize()
MsgBox(" OBJETO DESTRUIDO ")
End Sub
End Class
Detalles de la clase
Module Module1
Dim objeto As circulo
Dim radio, area As Single
Sub Main()
objeto = New circulo(20)
Console.Write("ingrese radio ")
radio = Console.ReadLine
objeto.Radio = radio
objeto.CalcularArea()
area = objeto.Area
Console.WriteLine(" el area es {0}", area)
Console.ReadLine()
End Sub
End Module
CLASE PERSONA
Public Class PERSONA
' CAMPOS
Private Nombre1 As String
Private DNi1 As Integer
' propiedades
Property Nombre As String
Get
Nombre = Nombre1
' Return Nombre1
End Get
Set(value As String)
Nombre1 = value
End Set
End Property
Property Dni As Integer
Get
Dni = DNi1
End Get
Set(value As Integer)
DNi1 = value
End Set
End Property
Sub MostrarDatos()
Console.WriteLine(" el nombre es {0} ", Nombre1)
Console.WriteLine(" Dni es {0} ", DNi1)
End Sub
Sub New(Optional nombre2 As String = "FULANO", Optional dNI2 As Integer = 0)
Nombre1 = nombre2
DNi1 = dNI2
End Sub
Protected Overrides Sub Finalize()
Console.WriteLine("objeto destruido")
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -23
End Sub
End Class
Module Module1
Dim Juan As PERSONA
Dim Pedro As PERSONA
Dim Carlos As PERSONA
Sub Main()
Juan = New PERSONA()
Pedro = New PERSONA("PEDRO")
Carlos = New PERSONA("CARLOS", 1234)
Juan.MostrarDatos()
Pedro.MostrarDatos()
Carlos.MostrarDatos()
Juan.Nombre = "JUAN PEREZ"
Juan.MostrarDatos()
Console.ReadLine()
End Sub
End Module
Module Module1
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -24
End Get
Set(value As Single)
SUELDO1 = value
End Set
End Property
End Class
Diagrama de clases
'Return dni
End Get
Set(value As Integer)
dni1 = value
End Set
End Property
Sub New(Optional nombre2 As String = "FULANO",
Optional DNI2 As Integer = 0)
nombre1 = nombre2
dni1 = DNI2
End Sub
Protected Overrides Sub Finalize()
Console.WriteLine(" OBJETO DESTRUIDO")
End Sub
Sub MostrarDatos()
Console.WriteLine(" {0}{1}{2} ", nombre1, vbTab, dni1)
End Sub
End Class
tarea ‘ generar 100 objetos de personas cuyo nombres sean nombre1 2,3,99 y sus dni
aleatorios
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -27
Module Module1
Const N As Integer = 10
Dim A(N) As Persona
Sub Main()
Dim fila As Integer
For fila = 0 To N - 1
A(fila) = New Persona("persona" & fila, Int(Rnd() * 1000000))
Next
For fila = 0 To N - 1
A(fila).MostrarDatos()
Next
Console.ReadLine()
End Sub
End Module
Module Module1
Const N As Integer = 10
Dim A(N) As Persona
Dim nletras = 5
Sub Main()
Randomize()
Dim fila, col As Integer
Dim cadena As String
For fila = 0 To N - 1
Dim letra As String
cadena = ""
For col = 1 To 5
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -28
Module Module1
Dim N As Integer
Dim A(100) As Persona
Sub Main()
' instancio
Console.Write(" CUANTOS DATOS QUIERE INGRESAR ")
N = Console.ReadLine
For fila = 0 To N - 1
A(fila) = New Persona()
Next
' ingreso
For fila = 0 To N - 1
Console.WriteLine(" ingrese nombre {0} ", fila)
A(fila).nombre = Console.ReadLine
Console.WriteLine(" ingrese DNI {0} ", fila)
A(fila).dni = Console.ReadLine
Next
'MUESTRA
Console.WriteLine("DATOS INGRESADOS")
For fila = 0 To N - 1
A(fila).MostrarDatos()
Next
Console.ReadLine()
End Sub
End Module
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -29
Module Module1
Dim Juan, pedro, lucas As PERSONA
Sub Main()
Juan = New PERSONA()
pedro = New PERSONA("pedro")
lucas = New PERSONA("LUCAS", 234)
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -30
Module Module1
Const N As Integer = 20
Dim A(N) As PERSONA
Dim Cadena, letra As String
Dim np As Integer
Sub Main()
Console.Write(" cuantas personas son")
np = Console.ReadLine
' instanciando
For fila = 0 To np - 1
A(fila) = New PERSONA()
Next
Console.WriteLine("lectura de datos")
For fila = 0 To np - 1
Console.Write("nombre {0} ", fila)
A(fila).NOMBRE = Console.ReadLine
Console.Write("dni {0} ", fila)
A(fila).DNI = Console.ReadLine
Next
Console.WriteLine("mostrando datos")
For fila = 0 To np - 1
A(fila).MostrarDatos()
Next
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module1
Dim A(100) As PERSONA
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -32
2.usando esa clase genere 3 objetos , uno sin parámetros, otros con un parámetro, y
otro con dos parámetros
3. genere 100 objetos donde el nombre de 5 letras generados en forma aleatoria y su
dni también con números de hasta 8 digitos
4. ingres n nombres y su dnis por teclado y que luego los muestre
5 lo mis mismo que la pregutna 4 pero de el ingreso es de archivos
Module Module1
Const N As Integer = 20
Dim A(N) As PERSONA
Dim cadena, letra As String
Sub Main()
Randomize()
Dim fila, COL As Integer
For fila = 0 To N - 1
cadena = ""
For COL = 1 To 4
letra = Chr(65 + Int(Rnd() * 20))
cadena = cadena + letra
Next
A(fila) = New PERSONA(cadena, Int(Rnd() * 10000000))
Next
For fila = 0 To N - 1
A(fila).MostrarDatos()
Next
Console.ReadLine()
End Sub
End Module
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -35
Module Module1
Const N As Integer = 20
Dim A(N) As PERSONA
Dim np As Integer
Sub Main()
Dim fila As Integer
Console.Write(" cuantos datos son ")
np = Console.ReadLine
Console.WriteLine(" primero instanciamos")
For fila = 0 To np - 1
A(fila) = New PERSONA()
Next
Console.WriteLine(" luego leemos")
For fila = 0 To np - 1
Console.Write(" nombre {0} ", fila)
A(fila).Nombre = Console.ReadLine
Console.Write(" DNI {0} ", fila)
A(fila).Dni = Console.ReadLine
Next
Console.WriteLine(" luego MOSTRAMOS")
For fila = 0 To np - 1
A(fila).MostrarDatos()
Next
Console.ReadLine()
End Sub
End Module
1. derive la clase alumno que tiene su propiedad nota y la clase profesor que tiene
su propiedad sueldo
2. liste los alumnos aprobados con su nombre y su notas
3. encuentre el promedio de sueldo de profesores
4. lo mismo pero en windows form
Leer lo datos de un archivo de texto y asignarlos a los objetos de clase alumnos los
nombres y las notas
Imports System.IO
Module Module1
Const na As Integer = 1000
Dim A(na) As alumno
Sub main()
Dim srLector As StreamReader = New StreamReader("F:\DATOS\ALUMNOS.txt")
Dim Linea, nombre As String
Dim pos, nota, nobj, fila As Integer
Dim cont As Integer
Console.WriteLine("lectura de archivos")
Linea = srLector.ReadLine()
Do While Not (Linea Is Nothing)
A(cont) = New alumno()
pos = InStr(Linea, vbTab)
nombre = Mid(Linea, 1, pos - 1)
nota = CInt(Mid(Linea, pos + 1))
A(cont).nombre = nombre
A(cont).nota = nota
' Console.WriteLine(Linea)
Linea = srLector.ReadLine()
cont = cont + 1
Loop
nobj = cont
Console.WriteLine("los objetos leidos son ")
For fila = 0 To nobj - 1
Console.WriteLine(" {0} {1} {2}", A(fila).nombre, vbTab, A(fila).nota)
Next
Console.ReadLine()
End Sub
End Module
Se tiene las clases persona, alumnos, profesor que tienen la siguiente estructura
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -38
End Sub
Private Sub lclick(ByVal sender As Object, ByVal e As EventArgs)
Dim l As Button = CType(sender, Button)
valor = Not valor
l.BackColor = System.Drawing.Color.FromArgb(255, 255, 0)
End Sub
Private Sub lenter(ByVal sender As Object, ByVal e As EventArgs) '' [b]handles
Button1.click, button2.click[/b]
Dim l As Button = CType(sender, Button)
l.BackColor = System.Drawing.Color.FromArgb(0, 255, 0)
End Sub
Private Sub lleave(ByVal sender As Object, ByVal e As EventArgs) '' [b]handles
Button1.click, button2.click[/b]
Dim l As Button = CType(sender, Button)
If valor Then
l.BackColor = System.Drawing.Color.FromArgb(0, 0, 255)
Else
l.BackColor = System.Drawing.Color.FromArgb(255, 0, 0)
End If
End Sub
End Class
Get
SUELDO = SUELDO1
End Get
Set(value As Single)
SUELDO1 = value
End Set
End Property
End Class
Console.ReadLine()
End Sub
End Module
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -45
Module Module1
Dim A(100) As alumno
Dim ca As Integer = 2
Sub Main()
Dim fila As Integer
Console.WriteLine("cuantos datos quieres ingresar")
ca = Console.ReadLine
For fila = 0 To ca - 1
A(fila) = New alumno
Console.WriteLine(" ingrese nombre")
A(fila).Nombre = Console.ReadLine
Console.WriteLine(" ingrese nota")
A(fila).nota = Console.ReadLine
Next
Console.WriteLine("datos ingresados")
For fila = 0 To ca - 1
A(fila).MostrarDatosAlumno()
Next
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module1
Dim A(100) As alumno
Dim ca As Integer = 2
Sub Main()
Dim cadena, nombre As String
Dim nota, pos, cont As Integer
Dim Archivo As StreamReader
Archivo = New StreamReader("F:\datos\notas.txt")
cadena = Archivo.ReadLine
cont = 0
Do While Not (cadena Is Nothing)
pos = InStr(1, cadena, vbTab)
nombre = Mid(cadena, 1, pos - 1)
nota = CInt(Mid(cadena, pos + 1))
A(cont) = New alumno
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -46
AYUDA
Sugerencia como hacer su sistema sencillo Ejemplo tengo un base de datos
llamado Tienda que tiene las siguientes tablas
PRODUCTOS
CODPRODUCTO NOMBREPRODUCTO presentacion Pu
P1 Arroz saco 130
P2 Azucar saco 120
P3 Fideos bolsa 50
P4 galletas Caja 30
Practicas de laboratorio de Sistemas de Información 2018\Ismael Veliz Vilca -47
VENTAS
NRO fechaVenta CodProducto Cantidad Monto Cliente
1 2/05/2018 P1 2 260 C1
2 3/05/2018 P2 3 360 C1
3 3/05/2018 P1 10 1300 C2
4 3/05/2018 P3 3 500 C3
CLIENTES
CODCLI NOMBRECLI
JUAN
C1 PEREZ
PEDRO
C2 RIOS
C3 MARIA
C4 JOSE
Tabla ventas
CREATE TABLE Ventas
(Nro int ,
FechaVenta date,
CodProducto varchar(5),
Cantidad int,
Monto money,
CodCli varchar(5),
primary key (nro)
)
Tabla clientes
NombreCli varchar(50),
primary key (CodCli)
)
CONSULTA 1
SELECCIONAR CAMPOS
Resultado
Suponiendo que se tiene un descuento de 10% en los productos cual seria el precio de
oferta
codigo_cliente nombrecli
C1 JUAN PEREZ
C2 PEDRO RIOS
C3 MARIA
C4 JOSE
Coincidencia de patrones
HAVING .- tiene un efecto similar similar a WHERE , pero solo trabaja de acuerdo a los
resultados obtenidos por GROUP BY . Con la siguiente Instrucción
Lo Mismo que el anterior pero solo cuando los promedios son mayors que 500
CON WHERE
SELECT A.CODPRODUCTO , NOMBREPRODUCTO, A.CODCLI,NOMBRECLI FROM
VENTAS A, PRODUCTOS B,CLIENTES C
WHERE A.CodProducto =B.CodProducto AND A.CodCli =C.CodCli
LA COMPOSICION EXTERNA
Obtener la siguiente table
5.17 UNION.
EL OPERADOR UNION
5.18 LAS CONSULTAS DE REFERENCIAS CRUZADAS
5.19 FUNCIONES DE FECHA Y HORA
LAS CONSULTAS DE ACCIÓN
Ya visto
Crear una tabla en base a una consulta