-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCola_Enlazada.cpp
More file actions
50 lines (44 loc) · 891 Bytes
/
Cola_Enlazada.cpp
File metadata and controls
50 lines (44 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<iostream>
#include "ColaEnlazada.h"
using namespace std;
template<class T>
void ColaEnlazada<T>::insertar(T elemento){
cola.insertarInicio(elemento);
talla++;
}
template<class T>
T ColaEnlazada<T>::eliminarSalida(){
T tmp;
tmp = cola.getUltimoDato();
cola.eliminarNodo(tmp);
talla--;
return tmp;
}
template<class T>
void ColaEnlazada<T>::limpiarCola(){
if(!colaVacia()){
Nodo<T>* n;
n = cola.buscarDato(cola.getDato());
while(cola.buscarDato(n -> datoNodo()) != NULL)
eliminarSalida();
talla = 0;
}
}
template<class T>
T ColaEnlazada<T>::salidaCola(){
if(!colaVacia())
return cola.getUltimoDato();
else
return 0;
}
template<class T>
bool ColaEnlazada<T>::colaVacia(){
if(!cola.listaVacia())
return true;
else
return false;
}
template<class T>
int ColaEnlazada<T>::tallaCola(){
return talla;
}