Thursday, October 30, 2008

Practica 8 consola

using System;
using System.Collections.Generic;
using System.Text;

namespace Aplicacion_consola_tres_dimensionaes
{
class Program
{
static void Main(string[] args)
{
double[, ,] compañía;
int numS, noDep, dias;
Console.Write("Introduce el número de sucursales: ");
numS = int.Parse(Console.ReadLine());
Console.Write("Introduce el número de departamentos: ");
noDep = int.Parse(Console.ReadLine());
Console.Write("Introduce el número de dias : ");
dias = int.Parse(Console.ReadLine());
compañía = new double[numS, noDep, dias];
int p, s, t;
for (p = 0; p < numS; p++)
{
Console.WriteLine("Sucursal {0}: ", p + 1);
for (s = 0; s < noDep; s++)
{
Console.WriteLine("Departamento {0}: ", s + 1);
for (t = 0; t < dias; t++)
{
Console.Write(" dia {0}: ", t + 1);
compañía[p, s, t] = double.Parse(Console.ReadLine());
}
}
}
double suma = 0.0;
for (p = 0; p < numS; p++)
{
suma = 0.0;
for (s = 0; s < noDep; s++)
{
suma = 0.0;
for (t = 0; t < dias; t++)
{
suma += compañía[p, s, t];

}
Console.WriteLine("venta total por sucursal:{0}", suma);
}
Console.WriteLine(" No de Sucursal: {0} ", p + 1);
Console.WriteLine(" Venta Total es : {0} ", suma);
}

Console.ReadLine();

}
}
}

No comments: