-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
164 lines (162 loc) · 5.61 KB
/
main.cpp
File metadata and controls
164 lines (162 loc) · 5.61 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include <iostream>
#include <cstdlib>
#include <string>
#include "VGeneral.h"
#include "Lista.h"
using namespace std;
int main ()
{
int valor, valor2, respuesta,lim,lim2;
Lista<int> Lista10Num;
Lista<int> ListaAux;
VGeneral vg;
do
{
lim=Lista10Num.Contar();
lim2=ListaAux.Contar();
vg.Limpiar();
cout<<"=============================================================================="<<endl;
cout<<"----------------------------- MENU DE OPCIONES -----------------------------"<<endl;
cout<<"=============================================================================="<<endl;
cout<<"\n1-) INSERTAR n NUMEROS ENTEROS"<<endl;
cout<<"2-) IMPRIMIR NUMEROS ENTEROS"<<endl;
cout<<"3-) ELIMINAR ELEMENTOS DE LA LISTA"<<endl;
cout<<"4-) ELEMENTOS ACTUALES EN LA LISTA"<<endl;
cout<<"5-) SALIR\n"<<endl;
cout<<"=============================================================================="<<endl;
respuesta= vg.LeerValidarNro("\n Opcion seleccionada : ",1,5);
switch (respuesta)
{
case 1:
vg.Limpiar();
cout<<"=============================================================================="<<endl;
cout<<"--------------------------- SUB-MENU DE OPCIONES ---------------------------"<<endl;
cout<<"=============================================================================="<<endl;
cout<<"\n1-) INDIQUE EL NUMERO DE ELEMENTOS A INSERTAR"<<endl;
cout<<"=============================================================================="<<endl;
valor2= vg.LeerValidarNroValorInicial("\n Numero de elementos : ",0);
vg.Limpiar();
cout<<"=============================================================================="<<endl;
cout<<"------------------------------ LLENAR LA LISTA -----------------------------"<<endl;
cout<<"=============================================================================="<<endl;
for(int i=1;i<valor2+1;i++)
{
valor=vg.LeerNro("\n Numero de elementos : ");
if(!Lista10Num.InsComienzo(valor))
{
cout<<"\n\n\tNO SE PUDO INSERTAR EL NUMERO"<<endl;
system("pause");
break;
}
}
cout<<"=============================================================================="<<endl;
cout<<"--------------------- ELEMENTOS INSERTADOS CON EXITO ----------------------"<<endl;
cout<<"=============================================================================="<<endl;
vg.Pausa();
break;
case 2:
vg.Limpiar();
cout<<"=============================================================================="<<endl;
cout<<"--------------------------- SUB-MENU DE OPCIONES ---------------------------"<<endl;
cout<<"=============================================================================="<<endl;
cout<<"1-) Imprimir y vaciar"<<endl;
cout<<"2-) Imprimir"<<endl;
cout<<"3-) Atras\n"<<endl;
valor2 = vg.LeerValidarNro(" Opcion seleccionada : ",1,3);
if (!Lista10Num.Vacia())
{
if(valor2==1)
{
for(int i=0;i<lim;i++)
{
if(Lista10Num.EliComienzo(valor))
{
cout<<"\t -) "<<valor<<"\n";
}
}
vg.Pausa();
}
else if(valor2==2)
{
for(int i=0;i<lim;i++)
{
if(Lista10Num.EliComienzo(valor))
{
cout<<"\t -) "<<valor<<"\n";
ListaAux.InsComienzo(valor);
}
}
lim2=ListaAux.Contar();
for(int i=0;i<lim2;i++)
{
if(ListaAux.EliComienzo(valor))
{
Lista10Num.InsComienzo(valor);
}
}
vg.Pausa();
}
}
else
{
cout<<"=============================================================================="<<endl;
cout<<"----------------------------- LISTA VACIA -----------------------------------"<<endl;
cout<<"==============================================================================\n"<<endl;
system("pause");
break;
}
break;
case 3:
vg.Limpiar();
cout<<"=============================================================================="<<endl;
cout<<"--------------------------- SUB-MENU DE OPCIONES ---------------------------"<<endl;
cout<<"=============================================================================="<<endl;
cout<<"1-) Vaciar Lista"<<endl;
cout<<"2-) Eliminar ultimo elemento"<<endl;
cout<<"3-) Atras\n"<<endl;
valor2 = vg.LeerValidarNro(" Opcion seleccionada : ",1,3);
if (!Lista10Num.Vacia())
{
if (valor2==1)
{
vg.Limpiar();
Lista10Num.~Lista();
cout<<"=============================================================================="<<endl;
cout<<"------------------------------ LISTA VACIADA -------------------------------"<<endl;
cout<<"=============================================================================="<<endl;
vg.Pausa();
}
else if (valor2==2)
{
if(!Lista10Num.Vacia())
{
if (!Lista10Num.Vacia())
{
if(Lista10Num.EliComienzo(valor))
{
cout<<"\n\tElmento eliminado: "<<valor<<"\n";
vg.Pausa();
}
}
}
}
}
else
{
cout<<"\n=============================================================================="<<endl;
cout<<"----------------------------- LISTA VACIA -----------------------------------"<<endl;
cout<<"==============================================================================\n"<<endl;
system("pause");
}
break;
case 4:
vg.Limpiar();
cout<<"\n TOTAL DE NUMEROS EN LA LISTA : "<<Lista10Num.Contar()<<"\n "<<endl;
vg.Pausa();
break;
default:
break;
}
}while(respuesta!=5);
return 0;
}