using System; using System.IO; public class QuinielaStats { const String unoequisdos="1X2"; public static void Main ( ) { DirectoryInfo dir = new DirectoryInfo(@"."); FileInfo[] files = dir.GetFiles( ); int [,] pronosticos = new int [3,3]; for ( int i = 0; i < 3; i ++ ) { for ( int j=0; j < 3; j++ ) { pronosticos[i,j] = 0; } } for ( int i = 0; i < files.Length; i ++ ) { if ( files[i].Name.StartsWith("quiniela") && files[i].Name.EndsWith(".dat") ) { Console.Write( "Procesando {0}\n", files[i].Name ); StreamReader stream = files[i].OpenText(); String linea; int contador = 0; do { linea = stream.ReadLine(); if ( linea != null ) { String[] valores = linea.Split(' ') ; for ( int j=0; j < 3; j++ ) { if ( valores[2].IndexOf( unoequisdos[j]) >= 0 ) { pronosticos[contador,j]++; } } } contador++; } while (linea != null); } } for ( int j = 0; j< 3; j++ ) { Console.Write( "Pronosticos partido {0} -> ", j ); for ( int k = 0; k < 3; k ++ ) { Console.Write( "{0}= {1} ", unoequisdos[k], pronosticos[j,k] ); } Console.Write( "\n" ); } } }