Programacion

Solo disponible en BuenasTareas
  • Páginas : 2 (390 palabras )
  • Descarga(s) : 0
  • Publicado : 28 de abril de 2011
Leer documento completo
Vista previa del texto
Module Module1

Sub Main()

Dim tablita(4, 3), sale(4), temporal, sum(4) As Double

lectura(tablita)
sales(tablita, sale, temporal)
SUMA(tablita, sum,temporal)
mostrar(sale, sum, tablita)
motabla(tablita, sale, sum)
End Sub

Sub lectura(ByVal tabla(,) As Double)

Dim i, l As Integer

For i = 0 To4

For l = 0 To 3
Console.Write("Department: " & i & " Quarter " & l & ": ")
tabla(i, l) = Console.ReadLine()
NextConsole.WriteLine()
Console.WriteLine("Next department")
Console.WriteLine()

Next

End Sub

Sub sales(ByVal cuadro(,) As Double, ByVal tablero() AsDouble, ByRef temp As Double)

Dim k, t As Integer

For k = 0 To 4
temp = 0

For t = 0 To 3

temp += cuadro(k, t)
Nexttablero(k) = temp
Next

End Sub

Sub SUMA(ByVal TABLA(,) As Double, ByRef SUM() As Double, ByVal TEMP As Double)

Dim O, E As Integer

For O = 0To 3
TEMP = 0
For E = 0 To 4
TEMP += TABLA(E, O)
Next
SUM(O) = TEMP
Next
End Sub

Sub mostrar(ByValresultados() As Double, ByVal sum() As Double, ByVal tabla(,) As Double)

Console.WriteLine()
Console.WriteLine("--Total Per Department--")

Dim U, J As Integer

ForU = 0 To 4
Console.WriteLine(U + 0 & ": " & resultados(U))

Next
For J = 0 To 3
If J = 0 Then
Console.WriteLine()Console.WriteLine("Quarter 0: " & sum(0))
End If
If J = 1 Then
Console.WriteLine("Quarter 1: " & sum(1))
End If
If J = 2 Then...
tracking img