Advertisement
Guest User

Ejemplo de recorrido por columna.

a guest
Jul 8th, 2010
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.01 KB | None | 0 0
  1. PROCEDURE   ImprimirTotalesPorArticulo( VAR matrizNegocioArticulo : tm_Ventas );
  2. VAR
  3.     articulo : INTEGER;
  4.     negocio : INTEGER;
  5.     totalArticulo : INTEGER;
  6. BEGIN
  7.  
  8.     {*
  9.     matrizNegocioArticulo tiene la siguiente representación:
  10.     Fila = nro de negocio
  11.     Columna = nro de articulo
  12.     *}
  13.    
  14.     {*
  15.         Recorro por Columna ( Articulo en este caso )
  16.             Luego por Fila ( Negocio )
  17.                 Acumulo lo vendido
  18.             Mostrar Resultado
  19.     *}
  20.  
  21.     {*Con este for voy tomando los articulos para obtener su total*}
  22.     FOR articulo := 1 TO _CANTIDAD_ARTICULOS DO
  23.     BEGIN
  24.        
  25.         {*Dejo fijo el articulo*}
  26.         totalArticulo := 0;
  27.        
  28.         {*Con este tomo por negocio*}
  29.         FOR negocio := 1 TO _CANTIDAD_NEGOCIOS_ DO
  30.         BEGIN
  31.  
  32.             {*Lo único que queda es acumular la cantidad vendida en el negocio para el articulo*}
  33.             totalArticulo := totalArticulo + matrizNegocioArticulo[ negocio, articulo ];
  34.        
  35.         END;
  36.        
  37.         {*Imprimo el resultado para el articulo en cuestion*}
  38.         writeln( 'articulo: ', articulo, ' total vendido:', totalArticulo );
  39.        
  40.     END;
  41.  
  42. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement