コード例 #1
0
        static void Main(string[] args)
        {
            Teatro teatrin;

            teatrin            = new Teatro(13, 16, "La vaca");
            teatrin.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatrin_Reservado);
            teatrin.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatrin_Reservado1);
            teatrin.Rechazado += new TeatroLib.Teatro.RechazadoEventHandler(teatrin_Rechazado);

            while (true)
            {
                Console.Write("Por favor, ingrese fila: ");
                string s1  = Console.ReadLine();
                int    row = int.Parse(s1);
                Console.Write("Por favor, ingrese asiento: ");
                string s2  = Console.ReadLine();
                int    col = int.Parse(s2);

                teatrin.ReservarAsiento(row, col);

                /*
                 * if (teatrin.EstaLibre(row, col))
                 * {
                 *      teatrin.ReservarAsiento(row, col);
                 *      Console.WriteLine("Reservado!!!");
                 * }
                 * else
                 * {
                 *      Console.WriteLine("Cagaste!!!");
                 * }
                 */
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Teatro teatro = new Teatro(13, 16, "La vaca");

            teatro.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatro_Reservado);
            teatro.Rechazado += new TeatroLib.Teatro.RechazadoEventHandler(teatro_Rechazado);

            Console.WriteLine(
                String.Format(
                    "Obra = {0}, espacio = {1} filas, {2} asientos",
                    teatro.Obra, teatro.Filas, teatro.Filas * teatro.AsientosPorFila));

            while (true)
            {
                Console.Write("Fila=");
                string s1  = Console.ReadLine();
                int    row = int.Parse(s1);
                Console.Write("Asiento=");
                string s2  = Console.ReadLine();
                int    col = int.Parse(s2);

                /*
                 * bool b = teatro.EstaLibre(row, col);
                 * if (b)
                 * {
                 *      teatro.ReservarAsiento(row, col);
                 *      Console.WriteLine("Reservado.");
                 * }
                 * else
                 * {
                 *      Console.WriteLine("Ocupado.");
                 * }
                 */

                teatro.ReservarAsiento(row, col);

                //Console.WriteLine("Asientos ocupados = {0}", teatro.AsientosOcupados);
                Console.WriteLine();
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Teatro teatro;

            teatro            = new Teatro("La vaca", 13, 16);
            teatro.Reservado += new TeatroLib.Teatro.ReservadoEventHandler(teatro_Reservado);
            teatro.Rechazado += new TeatroLib.Teatro.RechazadoEventHandler(teatro_Rechazado);
            while (true)
            {
                Console.Write("Fila=");
                string s1  = Console.ReadLine();
                int    row = int.Parse(s1);
                Console.Write("Asiento=");
                string s2  = Console.ReadLine();
                int    col = int.Parse(s2);
                teatro.ReservarAsiento(row, col);
                Console.WriteLine();
            }


            //
            // TODO: Add code to start application here
            //
        }