Exemple #1
0
        public Fila dividir()
        {
            Fila par   = new Fila();
            Fila impar = new Fila();

            while (counter > 0)
            {
                if (counter % 2 == 0)
                {
                    par.enfileirar(obterPrimeiro());
                    desenfileirar();
                }
                else
                {
                    impar.enfileirar(obterPrimeiro());
                    desenfileirar();
                }
            }
            Console.WriteLine("fila atual: ");
            impar.imprimir();
            Console.WriteLine("\nfila par: ");
            par.imprimir();

            return(par);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Clientes cli;
            Fila     filaLanchonete;

            filaLanchonete = new Fila();
            cli            = new Clientes("Maria", new DateTime(2018, 4, 14, 10, 41, 10));
            filaLanchonete.enfileirar(cli);
            cli = new Clientes("João", new DateTime(2018, 4, 14, 10, 43, 25));
            filaLanchonete.enfileirar(cli);
            cli = new Clientes("Ana", new DateTime(2018, 4, 14, 10, 44, 17));
            filaLanchonete.enfileirar(cli);
            cli = new Clientes("Bruno   ", new DateTime(2018, 4, 14, 10, 44, 17));
            filaLanchonete.enfileirar(cli);

            filaLanchonete.dividir();

            Console.ReadKey();
        }