Академический Документы
Профессиональный Документы
Культура Документы
Module Module1
Structure PRODUCTO
Dim CAT As Integer
Dim C As Integer
Dim N As String
Dim PRE As String
End Structure
Sub Main()
Dim P(100) As PRODUCTO
Dim A, I, C1, C2, C3, C4, S1, S2, S3, S4 As Integer
Dim PROM1, PROM2, PROM3, PROM4 As Single
C1 = 0
C2 = 0
C3 = 0
C4 = 0
S1 = 0
S2 = 0
S3 = 0
S4 = 0
Console.Write(" DIGA EL NÚMERO DE PRODUCTOS QUE DESEA ADQUIRIR ")
A = Console.ReadLine
For I = 0 To A - 1
Console.Write(" INDIQUE (1) COMIDA , (2) LIMPIEZA , (3) HIGIENE , (4)
BEBIDAS = ")
P(I).CAT = Console.ReadLine
If P(I).CAT = 1 Then
C1 = C1 + 1
Console.Write(" INGRESE CODIGO DE TRES DIGITOS = ")
P(I).C = Console.ReadLine
Console.Write(" INGRESE NOMBRE = ")
P(I).N = Console.ReadLine
Console.Write(" INGRESE PRECIO = ")
P(I).PRE = Console.ReadLine
S1 = S1 + P(I).PRE
End If
If P(I).CAT = 2 Then
C2 = C2 + 1
Console.Write(" INGRESE CODIGO DE TRES DIGITOS = ")
P(I).C = Console.ReadLine
Console.Write(" INGRESE NOMBRE = ")
P(I).N = Console.ReadLine
Console.Write(" INGRESE PRECIO = ")
P(I).PRE = Console.ReadLine
S2 = S2 + P(I).PRE
End If
If P(I).CAT = 3 Then
C3 = C3 + 1
Console.Write(" INGRESE CODIGO DE TRES DIGITOS = ")
P(I).C = Console.ReadLine
Console.Write(" INGRESE NOMBRE = ")
P(I).N = Console.ReadLine
Console.Write(" INGRESE PRECIO = ")
P(I).PRE = Console.ReadLine
S3 = S3 + P(I).PRE
End If
If P(I).CAT = 4 Then
C4 = C4 + 1
Console.Write(" INGRESE CODIGO DE TRES DIGITOS = ")
P(I).C = Console.ReadLine
Console.Write(" INGRESE NOMBRE = ")
P(I).N = Console.ReadLine
Console.Write(" INGRESE PRECIO = ")
P(I).PRE = Console.ReadLine
S4 = S4 + P(I).PRE
End If
Next
PROM1 = S1 / C1
PROM2 = S2 / C2
PROM3 = S3 / C3
PROM4 = S4 / C4
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 1 = " & PROM1)
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 2 = " & PROM2)
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 3 = " & PROM3)
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 4 = " & PROM4)
Console.WriteLine(" CÓDIGO Y NOMBRE DE PRODUCTOS DE LA CATEGORÍA 3 ")
For I = 0 To A - 1
If P(I).CAT = 3 Then
If P(I).PRE < 900 And P(I).PRE > 500 Then
End Module
Module Module1
Structure PRODUCTO
Dim CAT As Integer
Dim C As Integer
Dim N As String
Dim PRE As String
End Structure
Sub Main()
Dim P(100) As PRODUCTO
Dim A, I, C, S, J As Integer
Dim PROM(100) As Single
C = 0
S = 0
Console.Write(" DIGA EL NÚMERO DE PRODUCTOS QUE DESEA ADQUIRIR = ")
A = Console.ReadLine
For I = 0 To A - 1
Console.Write(" INDIQUE (1) COMIDA , (2) LIMPIEZA , (3) HIGIENE , (4)
BEBIDAS = ")
P(I).CAT = Console.ReadLine
For J = 1 To 4
If P(I).CAT = J Then
C = C + 1
Console.Write(" INGRESE CODIGO DE TRES DIGITOS = ")
P(I).C = Console.ReadLine
Console.Write(" INGRESE NOMBRE = ")
P(I).N = Console.ReadLine
Console.Write(" INGRESE PRECIO = ")
P(I).PRE = Console.ReadLine
S = S + P(I).PRE
End If
Next
Next
PROM(I) = S / C
For I = 1 To 4
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA " & I & "
= " & PROM(I))
Next
Console.WriteLine(" CÓDIGO Y NOMBRE DE PRODUCTOS DE LA CATEGORÍA 3 ")
For I = 0 To A - 1
If P(I).CAT = 3 Then
If P(I).PRE < 900 And P(I).PRE > 500 Then
End Module
Module Module1
Structure PRODUCTO
Dim CAT As Integer
Dim C As Integer
Dim N As String
Dim PRE As String
End Structure
Sub Main()
Dim P(100) As PRODUCTO
Dim A, I, C1, C2, C3, C4, S1, S2, S3, S4 As Integer
Dim C(100), S(100) As Integer
Dim PROM1, PROM2, PROM3, PROM4 As Single
C1 = 0
C2 = 0
C3 = 0
C4 = 0
S1 = 0
S2 = 0
S3 = 0
S4 = 0
Console.Write(" DIGA EL NÚMERO DE PRODUCTOS QUE DESEA ADQUIRIR = ")
A = Console.ReadLine
For I = 0 To A - 1
Console.Write(" INDIQUE (1) COMIDA , (2) LIMPIEZA , (3) HIGIENE , (4)
BEBIDAS = ")
P(I).CAT = Console.ReadLine
Console.Write(" INGRESE CODIGO DE TRES DIGITOS = ")
P(I).C = Console.ReadLine
Console.Write(" INGRESE NOMBRE = ")
P(I).N = Console.ReadLine
Console.Write(" INGRESE PRECIO = ")
P(I).PRE = Console.ReadLine
If P(I).CAT = 1 Then
C1 = C1 + 1
S1 = S1 + P(I).PRE
End If
If P(I).CAT = 2 Then
C2 = C2 + 1
S2 = S2 + P(I).PRE
End If
If P(I).CAT = 3 Then
C3 = C3 + 1
S3 = S3 + P(I).PRE
End If
If P(I).CAT = 4 Then
C4 = C4 + 1
S4 = S4 + P(I).PRE
End If
Next
PROM1 = S1 / C1
PROM2 = S2 / C2
PROM3 = S3 / C3
PROM4 = S4 / C4
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 1 = " & PROM1)
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 2 = " & PROM2)
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 3 = " & PROM3)
Console.WriteLine(" EL PROMEDIO DE PRECIOS DE LA CATEGORÍA 4 = " & PROM4)
Console.WriteLine(" CÓDIGO Y NOMBRE DE PRODUCTOS DE LA CATEGORÍA 3 ENTRE
UN RANGO ")
For I = 0 To A - 1
If P(I).CAT = 3 Then
If P(I).PRE < 900 And P(I).PRE > 500 Then
Console.WriteLine(P(I).C & " " & P(I).N)
End If
End If
Next
Console.ReadKey()
End Sub
End Module