2011-02-23 10:36:55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
 
namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      StreamReader sr = new StreamReader(@"C:\inputfile.txt");
 
      //Read all lines
      string strAllFile = sr.ReadToEnd();
      string[] arrLines = strAllFile.Split(new char[] { '\n' });
      sr.Close(); 
 
      //Read first line
      String string_firstline = arrLines[0];
      int total_engineers = Convert.ToInt32(new String(string_firstline[0], 1));
      int total_drinks = Convert.ToInt32(new String(string_firstline[2],1));
      Console.WriteLine("Total Engineers: "+total_engineers);
      Console.WriteLine("Total Drinks: "+total_drinks);
 
      //Read engineer's drink list
      int[,] engineer = new int[total_engineers, total_drinks];
      for (int i = 0,j; i < total_engineers; i++)
      {
        String a = arrLines[total_drinks + i + 1].ToString();
        var a2 = a.Skip(2);
        j = 0;
        Console.Write("Engineer[" + i +"]:{"); // Debug purpose
        foreach (var n in a2)
        {
          Regex myRegex = new Regex(@"\d");
          Match m = myRegex.Match(n.ToString());
          if (m.Success)
          {
            engineer[i, j] = Convert.ToInt32(new String(m.Value.ToString()[0], 1));
            Console.Write(engineer[i, j]); // Debug purpose
            j++;
          }
        }
        Console.Write("}\n"); // Debug purpose
      }
    }
  }
}
Invalid Email or Password