0% found this document useful (0 votes)
17 views2 pages

Pregunta 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Pregunta 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Pregunta 1

using System;
using System.Collections;
using System.IO;

namespace ProgramacionIII

class Program
{
static void Main(string[] args)
{

Queue cola = new Queue();


Queue colaOrdenada = new Queue();
cola.Enqueue("15-JOSE");
cola.Enqueue("16-PEDRO");
cola.Enqueue("12-MARIA");
cola.Enqueue("11-PATRICIA");
cola.Enqueue("17-MIGUEL");
int tamanio = cola.Count;
ArrayList datos = new ArrayList();
string[] colaunoArray = new string[tamanio];
cola.CopyTo(colaunoArray, 0);
for(int i = 0; i < colaunoArray.Length; i++)
{
datos.Add(colaunoArray[i]);
}
datos.Sort();

foreach(string dat in datos)


{
colaOrdenada.Enqueue(dat);
}
Console.WriteLine("Elementos de la primera cola");
Console.WriteLine("==============================");
for (int j = 0; j < tamanio; j++)
{
Console.WriteLine(cola.Dequeue());
}
Console.WriteLine("Elementos de la cola ordenada");
Console.WriteLine("==============================");
for (int k = 0; k < tamanio; k++)
{
Console.WriteLine(colaOrdenada.Dequeue());
}

You might also like