* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ejercicio5;
import Ejercicio1.Cola;
import java.util.Scanner;
public class InvertirCola {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
Cola<Integer> cola=new Cola();
System.out.println("Ingrese cantidad de datos ");
int can=sc.nextInt();
for(int i=0;i<can;i++){
System.out.println("Ingrese dato ["+1+i+"] fdg");
int a=sc.nextInt();
cola.encolar(a);
}
int a;
System.out.println("Colas invertidas");
while(!cola.esVacia()){
a=cola.desencolar();
System.out.println(a);
}
}
}
0 comentarios:
Publicar un comentario