Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Ejercicio:
Implementacion en C++:
/*
2.
3.
4.
5.
IDE: CodeBlocks
6.
7.
8.
*/
9.
#include<iostream>
10.
#include<cstdlib>
11.
#define maxchar 50
12.
13.
14.
15.
struct nodo2{
16.
char ingrediente[maxchar];
17.
18.
};
19.
20.
struct nodo{
21.
22.
char nombre[maxchar];
23.
float precio;
24.
int codigo;
25.
int cantIngred;
26.
nodo2 ingred[maxchar];
27.
28.
29.
};
30.
31.
32.
33.
34.
void menu(void){
35.
36.
cout<<"\n\t\t[
VENTA DE POSTRES
37.
cout<<"\t\t--------------------------------\n\n";
38.
39.
40.
]\n";
"<<endl;
"<<endl;
"<<endl;
41.
cout<<" 4. SALIR
"<<endl;
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
cout<<"\t\t------------";
53.
54.
55.
56.
cin.ignore();cout<<"\n\tNOMBRES:"; cin.getline(q->nombre,maxchar);
57.
cout<<"\n\tPRECIO:"; cin>>q->precio;
58.
59.
60.
cin>>q->cantIngred;
61.
62.
for(int i=0;i<q->cantIngred;i++){
63.
64.
cin.ignore();
65.
66.
cin.getline(q->ingred[i].ingrediente,maxchar);
67.
68.
69.
70.
cout<<endl;
71.
72.
system("cls");
73.
74.
q->sgte = NULL;
75.
76.
if(lista==NULL){
77.
78.
lista = q;
79.
80.
} else {
81.
82.
t = lista;
83.
84.
while(t->sgte!=NULL){
85.
86.
t = t->sgte;
87.
88.
89.
t->sgte = q;
90.
91.
92.
}
}
93.
94.
95.
96.
97.
int i=1;
98.
99.
while(q!=NULL){
100.
101.
102.
cout<<"\n\t------------------------";
103.
104.
cout<<"\n\tNOMBRE : "<<q->nombre<<endl;
105.
cout<<"\n\tPRECIO : "<<q->precio<<endl;
106.
cout<<"\n\tINGREDIENTES:"<<endl;
107.
108.
for(int j=0;j<q->cantIngred;j++){
109.
cout<<endl<<"\t"<<j+1<<".- "<<q->ingred[j].ingrediente;
110.
111.
112.
q=q->sgte;
113.
114.
i++;
115.
116.
117.
118.
119.
120.
121.
122.
int cant;
123.
int cod;
124.
125.
cout<<"\n\n\n\t";
126.
127.
128.
while(q!=NULL){
129.
130.
if(q->codigo==cod){
131.
132.
system("cls");
133.
134.
135.
cout<<"\n\t--------------------";
136.
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
137.
cout<<"\n\tNOMBRE : "<<q->nombre<<endl;
138.
cout<<"\n\tPRECIO : "<<q->precio<<endl;
139.
cout<<"\n\tINGREDIENTES:"<<endl;
140.
141.
for(int j=0;j<q->cantIngred;j++){
142.
143.
cout<<endl<<"\t"<<j+1<<".- "<<q->ingred[j].ingrediente;
144.
145.
146.
147.
cin>>cant;
148.
cout<<"\n\n\tTOTAL A PAGAR:"<<cant*q->precio;
149.
150.
151.
return;
152.
153.
}else {
154.
155.
156.
q=q->sgte;
157.
158.
159.
160.
161.
if(q==NULL)
162.
163.
cout<<"\n\tCODIGO INCORRECTO...!!\n";
}
164.
165.
166.
167.
/*------------------------FUNCION PRINCIPAL-------------------------*/
168.
int main(void){
169.
170.
system("color 0a");
171.
172.
TPostre lista=NULL;
173.
174.
int op;
175.
176.
do{
177.
menu();
178.
cin>>op;
179.
180.
switch(op){
181.
182.
case 1: registrar_postre(lista);
183.
break;
184.
185.
case 2: listar_postres(lista);
186.
break;
187.
188.
case 3: vender_postre(lista);
189.
break;
190.
191.
case 4: return 0;
192.
193.
194.
195.
196.
197.
cout<<endl;
198.
system("pause"); system("cls");
199.
200.
}while(op!=6);
201.
202.
system("pause");
203.
204.
return 0;
205.
/*
Autor: Joel Cesar Fernandez Segura
Curso: Estructura de Datos
Ejercicio: VENTA DE POSTRES
IDE: CodeBlocks
Pagina Web: http://codebotic.blogspot.com
*/
#include<iostream>
#include<cstdlib>
#define maxchar 50
using namespace std;
struct nodo2{
char ingrediente[maxchar];
};
struct nodo{
char nombre[maxchar];
float precio;
int codigo;
int cantIngred;
nodo2 ingred[maxchar];
struct nodo *sgte;
};
typedef struct nodo *TPostre;
/*-------------------- FUNCION MENU PRINCIPAL ------------------*/
void menu(void){
cout<<"\n\t\t[
VENTA DE POSTRES
]\n";
cout<<"\t\t--------------------------------\n\n";
cout<<" 1. REGISTRAR POSTRE
"<<endl;
cout<<" 2. LISTAR POSTRES
"<<endl;
cout<<" 3. VENDER POSTRE
"<<endl;
cout<<" 4. SALIR
"<<endl;
cout<<"\n Ingrese opcion : ";
}
/*------------------- FUNCION REGISTRAR UN POSTRE ------------------*/
void registrar_postre(TPostre &lista){
TPostre t,q = new(struct nodo);
cout<<"\n\n\t\t[ REGISTRO ]\n";
cout<<"\t\t------------";
cout<<endl<<"\t"<<j+1<<".- "<<q->ingred[j].ingrediente;
}
q=q->sgte;
i++;
}
}
/*-------------------- FUNCION VENDER POSTRE ------------------*/
void vender_postre(TPostre q){
int cant;
int cod;
cout<<"\n\n\n\t";
cout<<"\n\n\tINGRESE CODIGO DE VENTA:"; cin>>cod;
while(q!=NULL){
if(q->codigo==cod){
system("cls");
cout<<"\n\tDATOS DEL POSTRE";
cout<<"\n\t--------------------";
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
cout<<"\n\tNOMBRE : "<<q->nombre<<endl;
cout<<"\n\tPRECIO : "<<q->precio<<endl;
cout<<"\n\tINGREDIENTES:"<<endl;
for(int j=0;j<q->cantIngred;j++){
cout<<endl<<"\t"<<j+1<<".- "<<q->ingred[j].ingrediente;
}
cout<<"\n\n\tINGRESE CANTIDAD DE PORCIONES:";
cin>>cant;
cout<<"\n\n\tTOTAL A PAGAR:"<<cant*q->precio;
cout<<"\n\n\tGRACIAS POR SU COMPRA.....!!!!!!";
return;
}else {
q=q->sgte;
}
}
if(q==NULL)
cout<<"\n\tCODIGO INCORRECTO...!!\n";
}
/*------------------------FUNCION PRINCIPAL-------------------------*/
int main(void){
system("color 0a");
TPostre lista=NULL;
int op;
do{
menu();
cin>>op;
switch(op){
case 1: registrar_postre(lista);
break;
case 2: listar_postres(lista);
break;
case 3: vender_postre(lista);
break;
case 4: return 0;
Ejercicio:
Problema: Se tiene una lista de n pacientes, cada
paciente
debe
tener(cdigo,
nombres,
apellidos, direccin, telfono), se quiere crear un
programa que permita:
a. Registrar un nuevo paciente
b. Eliminar paciente (en cualquier posicin)
c. Actualizar Pacientes (modificar algn dato)
d. Mostrar Listado
e. Copiar datos de un paciente a otro.
Implementacion en C++:
/*
2.
3.
4.
5.
IDE: CodeBlocks
6.
7.
8.
*/
9.
10.
#include<iostream>
11.
#include<cstdlib>
12.
#include<string.h>
13.
#define maxchar 50
14.
15.
16.
17.
18.
struct nodo{
19.
20.
int codigo;
// campo codigo
21.
22.
23.
24.
25.
26.
27.
};
28.
29.
30.
31.
32.
33.
void menu(void){
34.
35.
cout<<"\n\t\t[
REGISTRO DE PACIENTES
]\n";
36.
cout<<"\t\t----------------------------\n\n";
37.
38.
39.
40.
41.
42.
cout<<" 6. SALIR
"<<endl;
"<<endl;
"<<endl;
"<<endl;
"<<endl;
"<<endl;
43.
44.
45.
46.
47.
48.
49.
void menu_actualizar(void){
50.
51.
cout<<"\n\t\t[
52.
cout<<"\t\t----------------------------\n\n";
53.
cout<<" 1. NOMBRES
"<<endl;
54.
cout<<" 2. APELLIDOS
"<<endl;
55.
cout<<" 3. DIRECCION
"<<endl;
56.
cout<<" 4. TELEFONO
"<<endl;
57.
cout<<" 5. SALIR
]\n";
"<<endl;
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
cout<<"\t\t------------";
70.
71.
cin.ignore();cout<<"\n\n\tCODIGO:"; cin>>q->codigo;
72.
cin.ignore();cout<<"\n\tNOMBRES:"; cin.getline(q->nombres,maxchar);
73.
cin.ignore();cout<<"\tAPELLIDOS:"; cin.getline(q->apellidos,maxchar);
74.
cin.ignore();cout<<"\tDIRECCION:"; cin.getline(q->direccion,maxchar);
75.
cin.ignore();cout<<"\n\tTELEFONO:"; cin>>q->telefono;
76.
77.
system("cls");
78.
79.
q->sgte = NULL;
80.
81.
if(lista==NULL){
82.
83.
lista = q;
84.
85.
} else {
86.
87.
t = lista;
88.
89.
while(t->sgte!=NULL){
90.
91.
t = t->sgte;
92.
93.
94.
t->sgte = q;
95.
96.
97.
}
}
98.
99.
100.
101.
102.
int cod;
103.
PLista q,t;
104.
q=lista;
105.
106.
cout<<"\n\n\n\tELIMINAR UN PACIENTE";
107.
108.
109.
while(q!=NULL){
110.
111.
if(q->codigo==cod){
112.
113.
114.
if(q==lista)
lista=lista->sgte;
115.
116.
117.
else
t->sgte=q->sgte;
118.
119.
delete(q);
120.
121.
cout<<"\n\n\tREGISTRO ELIMINADO...!!!!!\n";
122.
123.
return;
124.
125.
}else {
126.
127.
t=q;
128.
q=q->sgte;
129.
130.
131.
132.
133.
if(q==NULL)
134.
cout<<"\n\tCODIGO INCORRECTO...!!\n";
135.
136.
137.
138.
139.
140.
141.
142.
int cod, x;
143.
PLista q;
144.
q=lista;
145.
146.
147.
148.
149.
while(q!=NULL){
150.
151.
if(q->codigo==cod){
152.
system("cls");
153.
154.
cout<<"\n\t--------------------";
155.
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
156.
cout<<"\n\tNOMBRES : "<<q->nombres<<endl;
157.
cout<<"\tAPELLIDOS: "<<q->apellidos<<endl;
158.
cout<<"\tDIRECCION: "<<q->direccion<<endl;
159.
cout<<"\tTELEFONO : "<<q->telefono<<endl;
160.
161.
menu_actualizar();
162.
cin>>x;
163.
164.
switch(x){
165.
166.
167.
168.
break;
169.
170.
171.
cin.ignore(); cin.getline(q->apellidos,maxchar);
172.
break;
173.
174.
175.
cin.ignore(); cin.getline(q->direccion,maxchar);
176.
break;
177.
178.
179.
cin>>q->telefono;
180.
break;
181.
182.
183.
184.
185.
cout<<"\n\n\tREGISTRO ACTUALIZADO...!!!!!\n";
186.
187.
return;
188.
189.
}else {
190.
191.
192.
q=q->sgte;
193.
194.
195.
196.
197.
if(q==NULL)
198.
199.
cout<<"\n\tCODIGO INCORRECTO...!!\n";
}
200.
201.
202.
203.
204.
205.
int i=1;
206.
207.
while(q!=NULL){
208.
209.
210.
cout<<"\n\t------------------------";
211.
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
212.
cout<<"\n\tNOMBRES : "<<q->nombres<<endl;
213.
cout<<"\tAPELLIDOS: "<<q->apellidos<<endl;
214.
cout<<"\tDIRECCION: "<<q->direccion<<endl;
215.
cout<<"\tTELEFONO : "<<q->telefono<<endl;
216.
217.
q=q->sgte;
218.
219.
i++;
220.
221.
222.
223.
224.
225.
226.
227.
int cod1,cod2, x;
228.
PLista p,q,t;
229.
p=lista;
230.
q=lista;
231.
char dato[maxchar];
232.
233.
234.
cout<<"\n\n\n\t--------------------------------";
235.
236.
237.
system("cls");
238.
239.
while(p!=NULL){
240.
241.
if(p->codigo==cod1){
242.
t=p;
243.
244.
cout<<"\n\t---------------------------";
245.
cout<<"\n\n\tCODIGO : "<<p->codigo<<endl;
246.
cout<<"\n\tNOMBRES : "<<p->nombres<<endl;
247.
cout<<"\tAPELLIDOS: "<<p->apellidos<<endl;
248.
cout<<"\tDIRECCION: "<<p->direccion<<endl;
249.
cout<<"\tTELEFONO : "<<p->telefono<<endl;
250.
251.
252.
p=p->sgte;
253.
254.
255.
}
while(q!=NULL){
256.
257.
if(q->codigo==cod2){
258.
259.
260.
cout<<"\n\t--------------------";
261.
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
262.
cout<<"\n\tNOMBRES : "<<q->nombres<<endl;
263.
cout<<"\tAPELLIDOS: "<<q->apellidos<<endl;
264.
cout<<"\tDIRECCION: "<<q->direccion<<endl;
265.
cout<<"\tTELEFONO : "<<q->telefono<<endl;
266.
267.
menu_actualizar();
268.
cin>>x;
269.
270.
switch(x){
271.
272.
case 1: strcpy(dato,t->nombres);
273.
strcpy(q->nombres,dato);
274.
break;
275.
276.
case 2: strcpy(dato,t->apellidos);
277.
strcpy(q->apellidos,dato);
278.
break;
279.
280.
case 3: strcpy(dato,t->direccion);
281.
strcpy(q->direccion,dato);
282.
break;
283.
284.
case 4: q->telefono=t->telefono;
285.
break;
286.
287.
288.
289.
290.
cout<<"\n\n\tREGISTRO ACTUALIZADO...!!!!!\n";
291.
292.
return;
293.
294.
}else {
295.
296.
297.
q=q->sgte;
298.
299.
300.
301.
302.
303.
if(q==NULL)
304.
cout<<"\n\tCODIGO INCORRECTO...!!\n";
305.
306.
307.
308.
309.
int main(void){
310.
311.
system("color 0a");
312.
313.
PLista lista=NULL;
314.
315.
int opcion;
316.
317.
do{
318.
menu();
319.
cin>>opcion;
320.
321.
switch(opcion){
322.
323.
324.
case 1: registrar_pacientes(lista);
break;
325.
326.
case 2: if(lista==NULL){
327.
328.
329.
330.
}else{
331.
332.
eliminar_paciente(lista);
333.
334.
335.
break;
336.
337.
case 3: if(lista==NULL){
338.
339.
340.
341.
}else{
342.
343.
actualizar_paciente(lista);
344.
345.
346.
break;
347.
348.
case 4: if(lista==NULL){
349.
350.
351.
352.
}else {
353.
354.
mostrar_pacientes(lista);
355.
356.
357.
break;
358.
359.
case 5: if(lista==NULL){
360.
361.
362.
363.
}else{
364.
365.
copiar_datos_paciente(lista);
366.
367.
368.
break;
369.
370.
case 6: return 0;
371.
372.
373.
374.
375.
376.
377.
system("pause"); system("cls");
378.
379.
}while(opcion!=6);
380.
381.
system("pause");
382.
383.
384.
return 0;
}
/*
Autor: Joel Cesar Fernandez Segura
Curso: Estructura de Datos
Ejercicio: REGISTRAR PACIENTES
IDE: CodeBlocks
Pagina Web: http://codebotic.blogspot.com
*/
#include<iostream>
#include<cstdlib>
#include<string.h>
#define maxchar 50
using namespace std;
struct nodo{
int codigo;
// campo codigo
char nombres[maxchar]; // campo que almacena el nombre
char apellidos[maxchar];// campo que almacena el apellido
char direccion[maxchar];// campo que almacena la direccion
int telefono;// campo que almacena el telefono
struct nodo *sgte;
};
typedef struct nodo *PLista;
/*--------------------- FUNCION MENU PRINCIPAL --------------------*/
void menu(void){
cout<<"\n\t\t[ REGISTRO DE PACIENTES ]\n";
cout<<"\t\t----------------------------\n\n";
cout<<" 1. REGISTRAR PACIENTE
"<<endl;
cout<<" 2. ELIMINAR DATOS DE PACIENTE
"<<endl;
cout<<" 3. ACTUALIZAR PACIENTES
"<<endl;
cout<<" 4. MOSTRAR LISTADO
"<<endl;
cout<<" 5. COPIAR DATOS DE UN PACIENTE A OTRO
"<<endl;
cout<<" 6. SALIR
"<<endl;
cout<<"\n Ingrese opcion : ";
}
/*----------------- CUNCION PARA ACTUALIZAR UN DATO---------------*/
void menu_actualizar(void){
cout<<"\n\t\t[ ESPECIFIQUE CAMPO A ACTUALIZAR
cout<<"\t\t----------------------------\n\n";
cout<<" 1. NOMBRES
"<<endl;
]\n";
cout<<"
cout<<"
cout<<"
cout<<"
2.
3.
4.
5.
APELLIDOS
DIRECCION
TELEFONO
SALIR
"<<endl;
"<<endl;
"<<endl;
"<<endl;
while(q!=NULL){
if(q->codigo==cod){
if(q==lista)
lista=lista->sgte;
else
t->sgte=q->sgte;
delete(q);
cout<<"\n\n\tREGISTRO ELIMINADO...!!!!!\n";
return;
}else {
t=q;
q=q->sgte;
}
}
if(q==NULL)
cout<<"\n\tCODIGO INCORRECTO...!!\n";
}
/*-------------------- FUNCION ACTUALIZAR PACIENTE -------------------*/
void actualizar_paciente(PLista lista){
int cod, x;
PLista q;
q=lista;
cout<<"\n\n\n\tACTUALIZAR REGISTRO DE PACIENTE";
cout<<"\n\n\tINGRESE CODIGO:"; cin>>cod;
while(q!=NULL){
if(q->codigo==cod){
system("cls");
cout<<"\n\tDATOS DEL PACIENTE ";
cout<<"\n\t--------------------";
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
cout<<"\n\tNOMBRES : "<<q->nombres<<endl;
cout<<"\tAPELLIDOS: "<<q->apellidos<<endl;
cout<<"\tDIRECCION: "<<q->direccion<<endl;
cout<<"\tTELEFONO : "<<q->telefono<<endl;
menu_actualizar();
cin>>x;
switch(x){
case 1: cout<<"\n\n\tINGRESE NOMBRES:";
cin.ignore(); cin.getline(q->nombres,maxchar);
break;
case 2: cout<<"\n\n\tINGRESE APELLIDOS:";
cin.ignore(); cin.getline(q->apellidos,maxchar);
break;
case 3: cout<<"\n\n\tINGRESE DIRECCION:";
cin.ignore(); cin.getline(q->direccion,maxchar);
break;
case 4: cout<<"\n\n\tINGRESE TELEFONO:";
cin>>q->telefono;
break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n"; break;
}
cout<<"\n\n\tREGISTRO ACTUALIZADO...!!!!!\n";
return;
}else {
q=q->sgte;
}
}
if(q==NULL)
cout<<"\n\tCODIGO INCORRECTO...!!\n";
}
/*---------------------- FUNCION MOSTRAR PACIENTE -------------------*/
void mostrar_pacientes(PLista q){
int i=1;
while(q!=NULL){
cout<<"\n\tDATOS DEL PACIENTE ["<<i<<"] ";
cout<<"\n\t------------------------";
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
cout<<"\n\tNOMBRES : "<<q->nombres<<endl;
cout<<"\tAPELLIDOS: "<<q->apellidos<<endl;
cout<<"\tDIRECCION: "<<q->direccion<<endl;
cout<<"\tTELEFONO : "<<q->telefono<<endl;
q=q->sgte;
i++;
}
}
/*--------------- FUNCION COPIAR DATOS DE UN PACIENTEA OTRO
------------------*/
void copiar_datos_paciente(PLista lista){
int cod1,cod2, x;
PLista p,q,t;
p=lista;
q=lista;
char dato[maxchar];
cout<<"\n\n\n\tCOPIAR DATOS DE PACIENTE A OTRO";
cout<<"\n\n\n\t--------------------------------";
cout<<"\n\n\tINGRESE CODIGO DE PACIENTE A COPIAR:"; cin>>cod1;
cout<<"\n\n\tINGRESE CODIGO DE PACIENTE A SUSTITUIR:";cin>>cod2;
system("cls");
while(p!=NULL){
if(p->codigo==cod1){
t=p;
cout<<"\n\tDATOS DEL PACIENTE COPIAR ";
cout<<"\n\t---------------------------";
cout<<"\n\n\tCODIGO : "<<p->codigo<<endl;
cout<<"\n\tNOMBRES : "<<p->nombres<<endl;
cout<<"\tAPELLIDOS: "<<p->apellidos<<endl;
cout<<"\tDIRECCION: "<<p->direccion<<endl;
cout<<"\tTELEFONO : "<<p->telefono<<endl;
}
p=p->sgte;
}
while(q!=NULL){
if(q->codigo==cod2){
cout<<"\n\tDATOS DEL PACIENTE A SUSITUIR ";
cout<<"\n\t--------------------";
cout<<"\n\n\tCODIGO : "<<q->codigo<<endl;
cout<<"\n\tNOMBRES : "<<q->nombres<<endl;
cout<<"\tAPELLIDOS: "<<q->apellidos<<endl;
cout<<"\tDIRECCION: "<<q->direccion<<endl;
cout<<"\tTELEFONO : "<<q->telefono<<endl;
menu_actualizar();
cin>>x;
switch(x){
case 1: strcpy(dato,t->nombres);
strcpy(q->nombres,dato);
break;
case 2: strcpy(dato,t->apellidos);
strcpy(q->apellidos,dato);
break;
case 3: strcpy(dato,t->direccion);
strcpy(q->direccion,dato);
break;
case 4: q->telefono=t->telefono;
break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n"; break;
}
cout<<"\n\n\tREGISTRO ACTUALIZADO...!!!!!\n";
return;
}else {
q=q->sgte;
}
}
if(q==NULL)
cout<<"\n\tCODIGO INCORRECTO...!!\n";
}
/*------------------------- FUNCION PRINCIPAL -------------------*/
int main(void){
system("color 0a");
PLista lista=NULL;
int opcion;
do{
menu();
cin>>opcion;
switch(opcion){
case 1: registrar_pacientes(lista);
break;
case 2: if(lista==NULL){
cout<"\n\tNo Hay Pacientes Registrados.....!!!!\n";
}else{
eliminar_paciente(lista);
}
break;
case 3: if(lista==NULL){
cout<"\n\tNo Hay Pacientes Registrados.....!!!!\n";
}else{
actualizar_paciente(lista);
}
break;
case 4: if(lista==NULL){
cout<"\n\tNo Hay Pacientes Registrados.....!!!!\n";
}else {
mostrar_pacientes(lista);
}
break;
case 5: if(lista==NULL){
cout<"\n\tNo Hay Pacientes Registrados.....!!!!\n";
}else{
copiar_datos_paciente(lista);
}
break;
case 6: return 0;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n"; break;
}
system("pause"); system("cls");
}while(opcion!=6);
system("pause");
return 0;
}
Implementacion en C++:
Data hosted with by Pastebin.com - Download Raw - See Original
1.
/*
2.
3.
4.
IDE: Codeblocks
5.
Web: http://codebotic.blogspot.com
6.
7.
*/
8.
9.
#include<iostream>
10.
#include<cstdlib>
11.
#include<windows.h>
12.
#include<string.h>
13.
14.
#define max_char 30
15.
#define max_doce 12
16.
17.
#define Color_Red 12
18.
#define Color_Def 15
19.
#define Color_Yellow 14
20.
#define Color_Green 10
21.
22.
23.
24.
struct nodoProducto{
25.
int codProd;
26.
char nomProd[max_char];
27.
float precio;
28.
29.
};
30.
31.
32.
struct nodoLinea{
33.
34.
int codLinea;
35.
char descripLinea[max_char];
36.
37.
38.
};
39.
40.
41.
struct nodoCliente{
42.
int codCliente;
43.
char nomCliente[max_char];
44.
char apellCliente[max_char];
45.
int dniCliente;
46.
char rucCliente[max_doce];
47.
char telefono[max_doce];
48.
char direccion[max_char];
49.
char email[max_char];
50.
51.
52.
53.
struct nodoDetalleVenta{
54.
int codigo;
55.
int codProd;
56.
int cantidad;
57.
int codVenta;
58.
char marca[max_char];
59.
float subtotal;
60.
61.
62.
};
63.
64.
struct nodoVenta{
65.
int codigo;
66.
int monto;
67.
char fecha[max_doce];
68.
int codCliente;
69.
70.
71.
72.
};
73.
74.
struct nodoProveedor{
75.
int codProveedor;
76.
char razonSocial[max_char];
77.
char rucProveedor[max_doce];
78.
char telefono[max_doce];
79.
char direccion[max_char];
80.
char email[max_char];
81.
char web[max_char];
82.
83.
84.
85.
struct nodoDetallePedido{
86.
int codigo;
87.
int codProd;
88.
int cantidad;
89.
int codPedido;
90.
char marca[max_char];
91.
float subtotal;
92.
93.
94.
};
95.
96.
struct nodoPedido{
97.
int codigo;
98.
int monto;
99.
char fecha[max_doce];
100.
int codAlmacen;
101.
int codProveedor;
102.
103.
104.
105.
};
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
HANDLE hCon;
119.
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
120.
COORD dwPos;
121.
dwPos.X=x;
122.
dwPos.Y=y;
123.
SetConsoleCursorPosition(hCon,dwPos); }
124.
125.
126.
void titulo(void){
127.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Green);
128.
129.
cout<<"
_____________________________________________________________________"<<endl;
130.
cout<<"
____________________
131.
cout<<"
| IBA\xA5"<<"EZ
132.
cout<<"
||"<<endl;
XXXXXXXXXXXXXXXXXX
|"<<endl;
|___________ |"<<endl;
133.
cout<<"
SISTEMA DE ALMACEN
| CASTILLO ALVA
XXXXXXXXXXXXXXXXXX
| INDUSRY
||"<<endl;
134.
cout<<"
| BENITES
| COMPANY
||"<<endl;
135.
cout<<"
| ______________XXX________________| LUZURRIAGA
| BUSINESS
||"<<endl;
136.
cout<<"
| | _
+18 _
_ |
__ ____ _
137.
cout<<"
| | | | | | _____ | | | | | | |
______
138.
cout<<"
| ||
139.
cout<<"
| ______ ||"<<endl;
| | _ | ||"<<endl;
| | | | ||"<<endl;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^"<<endl;
140.
141.
142.
143.
144.
void menu1(void){
145.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
146.
cout<<"
147.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<<
SISTEMA DE ALMACEN
>>>>>>>>>>";
148.
cout<<"\n
149.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
150.
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
151.
cout<<"
//
// //
152.
cout<<"
(1)ALMACEN
153.
cout<<"
(2)CLIENTES
154.
cout<<"
(3)VENTAS
155.
cout<<"
(4)PROVEDORES
156.
cout<<"
(5)PEDIDOS
157.
cout<<"
(6)SALIR
158.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
159.
cout<<"
//
// ////
//
// // //
//
//
//
// //
// //
///////// //
//"<<endl;
// //
///
//
//"<<endl;
//"<<endl;
// // // //
//
//
// //////////"<<endl;
//"<<endl;
//"<<endl;
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
161.
cout<<"
162.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
163.
164.
165.
166.
167.
void menu2(void){
168.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
169.
cout<<"
---------------------------------------------------------------------\n";
170.
cout<<"
<<<<<<<<<<
ALMACEN
>>>>>>>>>>";
171.
cout<<"\n
172.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
173.
cout<<"
174.
cout<<"
(1)REGISTRAR LINEA
175.
cout<<"
(2)MOSTRAR LINEA
176.
cout<<"
(3)REGISTRAR PRODUCTO
//
// // // //
//"<<endl;
177.
cout<<"
(4)MOSTRAR PRODUCTOS
//
// //
//"<<endl;
178.
cout<<"
(5)REGRESAR
179.
cout<<"
180.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
181.
cout<<"
---------------------------------------------------------------------\n\n";
//
// //
// //////////"<<endl;
//
// ////
//
//
// // //
// //
///////// //
///
//
//
//"<<endl;
//
//"<<endl;
// //
//"<<endl;
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
183.
cout<<"
184.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
185.
186.
187.
188.
189.
190.
void menu3(void){
191.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
192.
cout<<"
193.
cout<<"
194.
cout<<"\n
195.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
196.
cout<<"
(1)REGISTRAR CLIENTE
197.
cout<<"
//
198.
cout<<"
199.
cout<<"
200.
cout<<"
(3)LISTAR CLIENTES
201.
cout<<"
//
202.
cout<<"
203.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
204.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<<
CLIENTES
>>>>>>>>>>";
---------------------------------------------------------------------\n\n";
//
// ////
(2)ACTUALIZAR CLIENTE
//
(5)REGRESAR
// //
//
//
//"<<endl;
// // //
// // // //
//
// //
///////// //
//
//"<<endl;
//"<<endl;
// //
///
// //////////"<<endl;
// //
//"<<endl;
//"<<endl;
//
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
206.
cout<<"
207.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
208.
209.
210.
211.
212.
213.
void menu_actualizar_cliente(void){
214.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
215.
cout<<"\n\n
216.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<< CLIENTES -> MODIFICAR DATOS
>>>>>>>>>>";
217.
cout<<"\n
---------------------------------------------------------------------\n\n";
218.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
219.
cout<<"
220.
cout<<"
(1)MODIFICAR NOMBRE
//
// ////
//
//"<<endl;
221.
cout<<"
(2)MODIFICAR APELLIDOS
//
// // //
//
//"<<endl;
222.
cout<<"
(3)MODIFICAR TELEFONO
//
// // // //
//"<<endl;
223.
cout<<"
(4)MODIFICAR E-MAIL
224.
cout<<"
(5)MODIFICAR DIRECCION
225.
cout<<"
(6)REGRESAR
226.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
227.
cout<<"
//
// //
// //////////"<<endl;
//
// //
//
// //
// //
///////// //
//"<<endl;
///
//
//"<<endl;
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
229.
cout<<"
230.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
231.
232.
233.
234.
235.
void menu4(void){
236.
237.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
238.
cout<<"
239.
cout<<"
240.
cout<<"\n
241.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
242.
cout<<"
243.
cout<<"
244.
cout<<"
245.
cout<<"
246.
cout<<"
(3)DETALLAR VENTA
247.
cout<<"
//
248.
cout<<"
249.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
250.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<<
VENTAS
>>>>>>>>>>";
---------------------------------------------------------------------\n\n";
(1)VENDER PRODUCTOS
//
// ////
//
// //
//
//"<<endl;
(5)REGRESAR
//
// // // //
//
// //
///////// //
// // //
//
//"<<endl;
//"<<endl;
// //
///
// //////////"<<endl;
// //
//"<<endl;
//"<<endl;
//
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
252.
cout<<"
253.
254.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
}
255.
256.
257.
void menu5(void){
258.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
259.
cout<<"
260.
cout<<"
261.
cout<<"\n
262.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
263.
cout<<"
264.
cout<<"
265.
cout<<"
266.
cout<<"
267.
cout<<"
268.
cout<<"
269.
cout<<"
270.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
271.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<<
PROVEEDORES
>>>>>>>>>>";
---------------------------------------------------------------------\n\n";
(1)REGISTRAR PROVEEDOR
//
//
// ////
//"<<endl;
//
// // //
// // // //
(3)LISTAR PROVEEDORES
//
// //
(5)REGRESAR
// //////////"<<endl;
//
(2)ACTUALIZAR PROVEEDOR
//
// //
//
//"<<endl;
//"<<endl;
//
// //
///
//"<<endl;
///////// //
//
// //
//"<<endl;
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
273.
cout<<"
274.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
275.
276.
277.
278.
279.
void menu_actualizar_proveedor(void){
280.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
281.
cout<<"
282.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<< PROVEEDORES -> MODIFICAR DATOS
>>>>>>>>>>";
283.
cout<<"\n
---------------------------------------------------------------------\n\n";
284.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
285.
cout<<"
286.
cout<<"
287.
cout<<"
(2)MODIFICAR TELEFONO
288.
cout<<"
(3)MODIFICAR E-MAIL
289.
cout<<"
(4)MODIFICAR DIRECCION
290.
cout<<"
(5)MODIFICAR WEB
291.
cout<<"
(6)REGRESAR
292.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
293.
cout<<"
//
// //
// //////////"<<endl;
//
//
//
// // //
//
//
// // // //
//
//
// ////
// //
// //
///////// //
//
//"<<endl;
//"<<endl;
// //
///
//"<<endl;
//"<<endl;
//"<<endl;
//"<<endl;
INFORMATICA - ESTRUCTURA DE
294.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
295.
cout<<"
296.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
297.
298.
299.
300.
301.
void menu6(void){
302.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
303.
cout<<"
304.
cout<<"
305.
cout<<"\n
306.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
307.
cout<<"
308.
cout<<"
309.
cout<<"
310.
cout<<"
//
311.
cout<<"
(3)DETALLAR PEDIDO
312.
cout<<"
313.
cout<<"
314.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Red);
315.
cout<<"
---------------------------------------------------------------------\n";
<<<<<<<<<<
PEDIDOS
>>>>>>>>>>";
---------------------------------------------------------------------\n\n";
(1)REALIZAR UN PEDIDO
//
//
// ////
// //
//
//"<<endl;
//
// // // //
//
// //
(5)REGRESAR
//
///
// // //
//
//"<<endl;
//"<<endl;
// //
///////// //
// //////////"<<endl;
// //
//"<<endl;
//"<<endl;
//
//"<<endl;
INFORMATICA - ESTRUCTURA DE
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Yellow);
317.
cout<<"
318.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), Color_Def);
319.
320.
321.
322.
323.
324.
if(arbol==NULL){
325.
326.
arbol->codLinea=x;
327.
cin.ignore();
328.
cout<<"\n\tingrese descripcion:";
329.
cin.getline(arbol->descripLinea,max_char);
330.
arbol->enlace=NULL;
331.
arbol->izq=NULL;
332.
arbol->der=NULL;
333.
334.
335.
336.
337.
338.
339.
340.
341.
if(arbol!=NULL){
342.
mostrar_linea(arbol->izq);
343.
cout<<"\n\t"<<arbol->codLinea<<"\t"<<arbol->descripLinea<<endl;
344.
mostrar_linea(arbol->der);
345.
346.
347.
348.
349.
350.
351.
352.
if (q==NULL){
353.
q=new(struct nodoProducto);
354.
q->codProd=x;
355.
cin.ignore();cout<<"\n\tNOMBRE:"; cin.getline(q->nomProd,max_char);
356.
cout<<"\n\tPRECIO:"; cin>>q->precio;
357.
q->izq=NULL;
358.
q->der=NULL;
359.
360.
361.
362.
363.
364.
/*---Funcion que busca el codigo de linea para agregar en el, el producto ingresaro
----*/
365.
366.
if(arbol!=NULL){
367.
if(arbol->codLinea==cod){
368.
int x;
369.
370.
cout<<"\t\t------------------------";
371.
cout<<"\n\tCODIGO:"; cin>>x;
372.
insertar_producto(arbol->enlace,x);
373.
374.
375.
376.
377.
}
}
378.
379.
/*--------- Funcion que muestra todos los productos ingresados en una linea ------*/
380.
381.
382.
if(q!=NULL){
383.
listar_productos(q->izq);
384.
cout<<"\t"<<q->codProd<<"\t"<<q->nomProd<<"\t"<<q->precio<<endl;
385.
listar_productos(q->der);
386.
387.
388.
389.
390.
/*--------- Funcion que valida de que linea se mostraran los productos ---------*/
391.
392.
if(arbol!=NULL){
393.
if(arbol->codLinea==x){
394.
395.
396.
listar_productos(arbol->enlace);
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
/*-----------------
407.
408.
409.
if(cliente==NULL){
410.
411.
cliente->codCliente=x;
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
cliente->izq=NULL;
422.
cliente->der=NULL;
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
if(cliente!=NULL){
if(cliente->codCliente==cod){
433.
434.
int op;
435.
system("cls");
436.
437.
cout<<"\t\t------------------------";
438.
cout<<"\n\n\tCODIGO :"<<cliente->codCliente;
439.
cout<<"\n\n\tNOMBRE :"<<cliente->nomCliente;
440.
cout<<"\n\n\tAPELLIDOS :"<<cliente->apellCliente;
441.
cout<<"\n\n\tDNI :"<<cliente->dniCliente;
442.
cout<<"\n\n\tRUC :"<<cliente->rucCliente;
443.
cout<<"\n\n\tTELEFONO :"<<cliente->telefono;
444.
cout<<"\n\n\tDIRECCION :"<<cliente->direccion;
445.
cout<<"\n\n\tE-MAIL :"<<cliente->email;
446.
447.
448.
menu_actualizar_cliente();
449.
cin>>op;
450.
switch(op){
451.
452.
case 1: cin.ignore();
453.
454.
cin.getline(cliente->nomCliente,max_char);
455.
break;
456.
457.
case 2: cin.ignore();
458.
459.
cin.getline(cliente->apellCliente,max_char);
460.
break;
461.
462.
case 3: cin.ignore();
463.
464.
cin.getline(cliente->telefono,max_doce);
465.
break;
466.
467.
case 4: cin.ignore();
468.
469.
cin.getline(cliente->email,max_char);
470.
break;
471.
472.
case 5: cin.ignore();
473.
474.
cin.getline(cliente->direccion,max_char);
475.
break;
476.
477.
case 6: break;
478.
479.
480.
481.
482.
483.
484.
485.
486.
487.
488.
489.
490.
491.
492.
493.
if(cliente!=NULL){
494.
495.
mostrar_clientes(cliente->izq);
496.
cout<<"\n\n\t\t[
497.
cout<<"\t\t------------------------";
498.
cout<<"\n\n\tCODIGO :"<<cliente->codCliente;
499.
cout<<"\n\n\tNOMBRE :"<<cliente->nomCliente;
500.
cout<<"\n\n\tAPELLIDOS :"<<cliente->apellCliente;
501.
cout<<"\n\n\tDNI :"<<cliente->dniCliente;
502.
cout<<"\n\n\tRUC :"<<cliente->rucCliente;
503.
cout<<"\n\n\tTELEFONO :"<<cliente->telefono;
504.
cout<<"\n\n\tDIRECCION :"<<cliente->direccion;
505.
cout<<"\n\n\tE-MAIL :"<<cliente->email;
506.
mostrar_clientes(cliente->der);
507.
MOSTRAR CLIENTES
]\n";
508.
509.
510.
511.
512.
if(cliente!=NULL){
513.
if(cliente->codCliente==cod){
514.
ptrCliente=cliente;
515.
return true;
516.
517.
518.
>izq,cod,ptrCliente);
519.
>der,cod,ptrCliente);
520.
521.
522.
523.
524.
525.
526.
527.
528.
if(producto!=NULL){
529.
530.
if(producto->codProd==codprod){
531.
puntProducto=producto;
532.
return true;
533.
534.
535.
536.
>izq,codprod,puntProducto);
537.
>der,codprod,puntProducto);
538.
539.
540.
541.
542.
543.
/*------- Funcion que busca el codigo de linea del producto en el arbol --------*/
544.
Producto &puntProducto){
545.
546.
bool validar;
547.
validar=false;
548.
if(arbol!=NULL){
549.
550.
if(arbol->codLinea==codlinea){
validar=validar_cod_producto(arbol->enlace,codprod,puntProducto);
551.
if (validar==true)
552.
return validar;
553.
554.
555.
>izq,codlinea,codprod,puntProducto);
556.
>der,codlinea,codprod,puntProducto);
557.
558.
559.
560.
561.
562.
563.
564.
bool validado;
565.
int codLinea,x;
566.
char op;
567.
568.
DetalleVenta t,r;
569.
r=new(struct nodoDetalleVenta);
570.
cout<<"\n\tCODIGO:";
571.
cin>>r->codigo;
572.
r->ptrProducto=NULL;
573.
validado=false;
574.
do{
575.
576.
cin>>codLinea;
577.
cout<<"\n\tCODIGO DE PRODUCTO:";
578.
cin>>x;
579.
validado=validar_codigo_producto(arbol,codLinea,x,r->ptrProducto);
580.
if(validado==true){
581.
582.
583.
584.
}
if(validado==false){
585.
cout<<"\n\tCODIGO INVALIDO...!!";
586.
587.
588.
cin>>op;
589.
switch(op){
590.
591.
592.
593.
594.
595.
596.
597.
598.
599.
600.
}while(validado==false);
601.
r->codProd=x;
602.
cout<<"\n\tCANTIDAD:";
603.
cin>>r->cantidad;
604.
605.
strcpy(r->marca,(r->ptrProducto)->nomProd);
606.
607.
r->subtotal=(r->cantidad)*((r->ptrProducto)->precio);
608.
r->sgte=NULL;
609.
610.
if(q==NULL)
611.
q=r;
612.
else{
613.
t=q;
614.
while(t->sgte!=NULL)
615.
t=t->sgte;
616.
617.
t->sgte=r;
618.
619.
620.
621.
622.
623.
624.
625.
626.
627.
char op;
628.
cout<<"\n\n\t\t[
629.
cout<<"\t\t-------------------------------";
630.
do{
631.
632.
insertar_producto_venta(detalle,arbol);
633.
634.
cin>>op;
635.
switch(op){
636.
637.
638.
639.
640.
641.
642.
643.
644.
645.
646.
}while(op=='y'||op=='Y');
647.
648.
649.
650.
/*------- Funcion que registra una venta a la lista enlazada venta --------*/
651.
652.
653.
654.
float total=0;
655.
bool validado;
656.
Venta q,t;
657.
DetalleVenta aux;
658.
q=new(struct nodoVenta);
659.
cout<<"\n\n\t\t[
660.
cout<<"\t\t------------------------";
661.
cout<<"\n\tCODIGO:";
662.
cin>>q->codigo;
663.
664.
validado=false;
665.
do{
666.
cout<<"\n\tCODIGO DE CLIENTE:";
667.
cin>>x;
668.
validado=validar_codigo_cliente(cliente,x,q->ptrCliente);
669.
if(validado==true)
670.
671.
672.
cout<<"\n\tNOMBRE:"<<(q->ptrCliente)->nomCliente;
if(validado==false)
cout<<"\n\tCODIGO INVALIDO...!!";
673.
674.
cin>>op;
675.
switch(op){
676.
677.
678.
679.
680.
681.
return ;
682.
683.
684.
return ;
685.
686.
687.
688.
}while(validado==false);
689.
690.
q->codCliente=x;
691.
q->detalle=NULL;
692.
q->sgte=NULL;
693.
694.
695.
aux=q->detalle;
696.
while(aux!=NULL){
697.
total=total+aux->subtotal;
698.
aux=aux->sgte;
699.
700.
q->monto=total;
701.
if(venta==NULL)
702.
venta=q;
703.
704.
else {
705.
t=venta;
706.
while(t->sgte!=NULL)
707.
t=t->sgte;
708.
709.
t->sgte=q;
710.
711.
712.
713.
714.
715.
716.
717.
int i=1;
718.
while(q!=NULL){
719.
720.
721.
cout<<"\n\t------------------------";
722.
723.
cout<<"\n\tFECHA : "<<q->fecha;
724.
725.
726.
cout<<"\n\tMONTO:"<<q->monto;
727.
728.
q=q->sgte;
729.
i++;
730.
731.
732.
733.
734.
/*------- Funcion que muestra una venta con sus productos --------*/
735.
736.
int i=1;
737.
while(q!=NULL){
738.
739.
if(q->codigo==cod){
740.
741.
cout<<"\n\t------------------------";
742.
743.
cout<<"\n\tFECHA : "<<q->fecha;
744.
745.
746.
cout<<"\n\tMONTO:"<<q->monto<<endl;
747.
while(q->detalle!=NULL){
748.
cout<<"\n\n\tPRODUCTO ["<<i<<"]\n";
749.
cout<<"\n\tCODIGO:"<<(q->detalle)->codigo;
750.
751.
cout<<"\n\tCANTIDAD:"<<(q->detalle)->cantidad;
752.
cout<<"\n\tMARCA:"<<(q->detalle)->ptrProducto->nomProd;
753.
cout<<"\n\tSUBTOTAL:"<<(q->detalle)->subtotal;
754.
(q->detalle)=(q->detalle)->sgte;
755.
i++;
756.
757.
q=q->sgte;
758.
759.
760.
else q=q->sgte;
761.
762.
763.
764.
765.
/*-----------------
766.
767.
768.
if(proveedor==NULL){
769.
770.
proveedor->codProveedor=x;
771.
772.
>razonSocial,max_char);
773.
774.
775.
>direccion,max_char);
776.
777.
778.
proveedor->izq=NULL;
779.
proveedor->der=NULL;
780.
781.
782.
783.
784.
785.
786.
787.
788.
789.
if(proveedor!=NULL){
if(proveedor->codProveedor==cod){
790.
791.
int op;
792.
system("cls");
793.
794.
cout<<"\t\t------------------------";
795.
cout<<"\n\n\tCODIGO :"<<proveedor->codProveedor;
796.
797.
cout<<"\n\n\tRUC :"<<proveedor->rucProveedor;
798.
cout<<"\n\n\tTELEFONO :"<<proveedor->telefono;
799.
cout<<"\n\n\tDIRECCION :"<<proveedor->direccion;
800.
cout<<"\n\n\tE-MAIL :"<<proveedor->email;
801.
cout<<"\n\n\tWEB :"<<proveedor->web;
802.
803.
804.
menu_actualizar_proveedor();
805.
cin>>op;
806.
switch(op){
807.
808.
case 1: cin.ignore();
809.
810.
cin.getline(proveedor->razonSocial,max_char);
811.
break;
812.
813.
case 2: cin.ignore();
814.
815.
cin.getline(proveedor->telefono,max_doce);
816.
break;
817.
818.
case 3: cin.ignore();
819.
820.
cin.getline(proveedor->email,max_char);
821.
break;
822.
823.
case 4: cin.ignore();
824.
825.
cin.getline(proveedor->direccion,max_char);
826.
break;
827.
828.
case 5: cin.ignore();
829.
830.
cin.getline(proveedor->web,max_char);
831.
break;
832.
833.
case 6: break;
834.
835.
836.
837.
838.
839.
840.
>izq,cod);
841.
>der,cod);
842.
843.
844.
845.
846.
847.
848.
849.
if(proveedor!=NULL){
850.
851.
mostrar_proveedores(proveedor->izq);
852.
cout<<"\n\n\t\t[
MOSTRAR PROVEEDOR
]\n";
853.
cout<<"\t\t------------------------";
854.
cout<<"\n\n\tCODIGO :"<<proveedor->codProveedor;
855.
856.
cout<<"\n\n\tRUC :"<<proveedor->rucProveedor;
857.
cout<<"\n\n\tTELEFONO :"<<proveedor->telefono;
858.
cout<<"\n\n\tDIRECCION :"<<proveedor->direccion;
859.
cout<<"\n\n\tE-MAIL :"<<proveedor->email;
860.
cout<<"\n\n\tWEB :"<<proveedor->web;
861.
mostrar_proveedores(proveedor->der);
862.
863.
}
}
864.
865.
866.
867.
int i=1;
868.
while(q!=NULL){
869.
870.
871.
cout<<"\n\t------------------------";
872.
873.
cout<<"\n\tFECHA : "<<q->fecha;
874.
875.
cout<<"\n\tRAZON SOCIAL:"<<(q->ptrProveedor)->razonSocial;
876.
cout<<"\n\tMONTO:"<<q->monto;
877.
878.
q=q->sgte;
879.
i++;
880.
881.
882.
883.
884.
885.
886.
887.
bool validado;
888.
int codLinea,x;
889.
char op;
890.
891.
DetallePedido t,r;
892.
r=new(struct nodoDetallePedido);
893.
cout<<"\n\tCODIGO:";
894.
cin>>r->codigo;
895.
r->ptrProducto=NULL;
896.
validado=false;
897.
do{
898.
899.
cin>>codLinea;
900.
cout<<"\n\tCODIGO DE PRODUCTO:";
901.
cin>>x;
902.
validado=validar_codigo_producto(arbol,codLinea,x,r->ptrProducto);
903.
if(validado==true){
904.
905.
906.
907.
908.
if(validado==false)
cout<<"\n\tCODIGO INVALIDO...!!";
909.
910.
cin>>op;
911.
switch(op){
912.
913.
914.
915.
916.
917.
918.
919.
920.
921.
922.
}while(validado==false);
923.
r->codProd=x;
924.
cout<<"\n\tCANTIDAD:";
925.
cin>>r->cantidad;
926.
927.
strcpy(r->marca,(r->ptrProducto)->nomProd);
928.
929.
r->subtotal=(r->cantidad)*((r->ptrProducto)->precio);
930.
r->sgte=NULL;
931.
932.
933.
934.
if(q==NULL)
q=r;
else{
935.
t=q;
936.
while(t->sgte!=NULL)
937.
t=t->sgte;
938.
939.
940.
t->sgte=r;
941.
942.
943.
944.
945.
946.
947.
/*------- Funcion que ordena agregar la cantidad de productos deseados al detalle del
pedido --------*/
948.
949.
950.
char op;
951.
cout<<"\n\n\t\t[
952.
cout<<"\t\t-------------------------------";
953.
do{
954.
955.
insertar_producto_pedido(detalle,arbol);
956.
957.
cin>>op;
958.
switch(op){
959.
960.
961.
962.
963.
964.
965.
966.
967.
968.
969.
}while(op=='y'||op=='Y');
970.
971.
972.
973.
974.
Proveedor &ptrProveedor){
975.
976.
977.
if(proveedor!=NULL){
if(proveedor->codProveedor==cod){
978.
ptrProveedor=proveedor;
979.
return true;
980.
981.
982.
>izq,cod,ptrProveedor);
983.
>der,cod,ptrProveedor);
984.
985.
986.
987.
988.
989.
990.
991.
992.
993.
float total=0;
994.
bool validado;
995.
Pedido q,t;
996.
DetallePedido aux;
997.
q=new(struct nodoPedido);
998.
cout<<"\n\n\t\t[
999.
cout<<"\t\t-----------------------------";
1000.
cout<<"\n\tCODIGO:";
1001.
cin>>q->codigo;
1002.
1003.
validado=false;
1004.
do{
1005.
cout<<"\n\tCODIGO DE PROVEEDOR:";
1006.
cin>>x;
1007.
validado=validar_codigo_proveedor(proveedor,x,q->ptrProveedor);
1008.
if(validado==true)
1009.
cout<<"\n\tRAZON SOCIAL:"<<(q->ptrProveedor)->razonSocial;
1010.
1011.
1012.
if(validado==false)
cout<<"\n\tCODIGO INVALIDO...!!";
1013.
1014.
cin>>op;
1015.
switch(op){
1016.
1017.
1018.
1019.
1020.
1021.
1022.
1023.
1024.
return ;
1025.
1026.
1027.
1028.
}while(validado==false);
1029.
1030.
q->codProveedor=x;
1031.
q->detalle=NULL;
1032.
q->sgte=NULL;
1033.
1034.
1035.
1036.
aux=q->detalle;
1037.
while(aux!=NULL){
1038.
total=total+aux->subtotal;
1039.
aux=aux->sgte;
1040.
1041.
q->monto=total;
1042.
if(pedido==NULL)
1043.
pedido=q;
1044.
1045.
else {
1046.
t=pedido;
1047.
while(t->sgte!=NULL)
1048.
t=t->sgte;
1049.
1050.
t->sgte=q;
1051.
1052.
1053.
1054.
1055.
1056.
1057.
int i=1;
1058.
while(q!=NULL){
1059.
1060.
if(q->codigo==cod){
1061.
1062.
cout<<"\n\t------------------------";
1063.
1064.
cout<<"\n\tFECHA : "<<q->fecha;
1065.
1066.
cout<<"\n\tRAZON SOCIAL:"<<(q->ptrProveedor)->razonSocial;
1067.
cout<<"\n\tMONTO:"<<q->monto<<endl;
1068.
while(q->detalle!=NULL){
1069.
cout<<"\n\n\tPRODUCTO ["<<i<<"]\n";
1070.
cout<<"\n\tCODIGO:"<<(q->detalle)->codigo;
1071.
1072.
cout<<"\n\tCANTIDAD:"<<(q->detalle)->cantidad;
1073.
cout<<"\n\tMARCA:"<<(q->detalle)->ptrProducto->nomProd;
1074.
cout<<"\n\tSUBTOTAL:"<<(q->detalle)->subtotal;
1075.
(q->detalle)=(q->detalle)->sgte;
1076.
i++;
1077.
1078.
q=q->sgte;
1079.
1080.
1081.
else q=q->sgte;
1082.
1083.
1084.
1085.
1086.
1087.
1088.
PROGRAMA
1089.
Linea arbol=NULL;
1090.
Cliente cliente=NULL;
1091.
Venta venta=NULL;
1092.
Proveedor proveedor=NULL;
1093.
Pedido pedido=NULL;
1094.
1095.
1096.
int op,op2,dato;
1097.
do{ titulo();
1098.
menu1();
1099.
cin>>op;
1100.
1101.
switch(op){
1102.
1103.
1104.
case 1: system("cls");
1105.
do{
1106.
titulo();
1107.
menu2();
1108.
cin>>op2;
1109.
1110.
switch(op2){
1111.
1112.
cin>>dato;
1113.
insertar_linea(arbol,dato);
1114.
break;
1115.
1116.
case 2: mostrar_linea(arbol);
1117.
break;
1118.
1119.
1120.
cin>>dato;
1121.
registrar_producto(arbol,dato);
1122.
break;
1123.
1124.
1125.
cin>>dato;
1126.
mostrar_producto(arbol,dato);
1127.
break;
1128.
1129.
case 5: break;
1130.
1131.
1132.
1133.
1134.
cout<<endl;
1135.
system("pause"); system("cls");
1136.
}while(op2!=5);
1137.
break;
1138.
1139.
1140.
case 2: system("cls");
1141.
do{
1142.
titulo();
1143.
menu3();
1144.
cin>>op2;
1145.
1146.
1147.
switch(op2){
case 1: cout<<"\n\n\t\t[ REGISTRO DE CLIENTE ]\n";
1148.
cout<<"\t\t------------------------\n";
1149.
cout<<"\n\tCodigo de cliente:";
1150.
cin>>dato;
1151.
registrar_cliente(cliente,dato);
1152.
break;
1153.
1154.
1155.
cout<<"\t\t------------------------\n";
1156.
cout<<"\n\tCodigo de cliente:";
1157.
cin>>dato;
1158.
actualizar_cliente(cliente,dato);
1159.
break;
1160.
1161.
case 3: system("cls");
1162.
mostrar_clientes(cliente);
1163.
break;
1164.
1165.
1166.
case 5: break;
1167.
1168.
1169.
1170.
1171.
cout<<endl;
1172.
system("pause"); system("cls");
1173.
}while(op2!=5);
1174.
break;
1175.
1176.
1177.
case 3: system("cls");
1178.
do{
1179.
titulo();
1180.
menu4();
1181.
cin>>op2;
1182.
1183.
1184.
1185.
switch(op2){
case 1: registrar_venta(venta,cliente,arbol);
break;
1186.
1187.
1188.
cout<<"\t\t------------------------\n";
1189.
listar_ventas(venta);
1190.
break;
1191.
case 3: cout<<"\n\n\t\t[
DETALLES DE VENTA
1192.
cout<<"\t\t------------------------\n";
1193.
1194.
cin>>dato;
1195.
mostrar_venta(venta,dato);
1196.
break;
1197.
1198.
case 5: break;
]\n";
1199.
1200.
1201.
1202.
1203.
cout<<endl;
1204.
system("pause"); system("cls");
1205.
}while(op2!=5);
1206.
break;
1207.
1208.
case 4: system("cls");
1209.
do{
1210.
titulo();
1211.
menu5();
1212.
cin>>op2;
1213.
1214.
switch(op2){
1215.
1216.
cout<<"\t\t------------------------\n";
1217.
cout<<"\n\tCodigo de Proveedor:";
1218.
cin>>dato;
1219.
registrar_proveedor(proveedor,dato);
1220.
break;
1221.
1222.
1223.
cout<<"\t\t------------------------\n";
1224.
cout<<"\n\tCodigo de Proveedor:";
1225.
cin>>dato;
1226.
actualizar_proveedor(proveedor,dato);
1227.
break;
1228.
1229.
case 3: system("cls");
1230.
mostrar_proveedores(proveedor);
1231.
break;
1232.
1233.
1234.
case 5: break;
1235.
1236.
1237.
1238.
1239.
cout<<endl;
1240.
system("pause"); system("cls");
1241.
}while(op2!=5);
1242.
break;
1243.
1244.
1245.
case 5: system("cls");
1246.
do{
1247.
titulo();
1248.
menu6();
1249.
cin>>op2;
1250.
1251.
switch(op2){
1252.
case 1: registrar_pedido(pedido,proveedor,arbol);
1253.
break;
1254.
1255.
1256.
cout<<"\t\t------------------------\n";
1257.
listar_pedidos(pedido);
1258.
break;
1259.
1260.
case 3: cout<<"\n\n\t\t[
DETALLES DE PEDIDO
1261.
cout<<"\t\t------------------------\n";
1262.
1263.
cin>>dato;
1264.
mostrar_pedido(pedido,dato);
1265.
break;
]\n";
1266.
1267.
case 5: break;
1268.
1269.
1270.
1271.
1272.
cout<<endl;
1273.
system("pause"); system("cls");
1274.
}while(op2!=5);
1275.
break;
1276.
case 6: return 0;
1277.
1278.
1279.
1280.
1281.
1282.
cout<<endl;
1283.
system("pause"); system("cls");
1284.
1285.
1286.
}while(op!=6);
1287.
system("pause");
1288.
1289.
1290.
1291.
return 0;
}
/*
Trabajo: Implementacion de un inventario
Curso: Estructura de Datos
IDE: Codeblocks
Web: http://codebotic.blogspot.com
*/
#include<iostream>
#include<cstdlib>
#include<windows.h>
#include<string.h>
#define max_char 30
#define max_doce 12
#define Color_Red 12
#define Color_Def 15
#define Color_Yellow 14
#define Color_Green 10
using namespace std;
/*------ estructura para productos por cada linea ------*/
struct nodoProducto{
int codProd;
char nomProd[max_char];
float precio;
struct nodoProducto *izq,*der;
};
/*------ estructura para linea ------*/
struct nodoLinea{
int codLinea;
char descripLinea[max_char];
struct nodoProducto *enlace;
float subtotal;
struct nodoProducto *ptrProducto;
struct nodoDetallePedido *sgte;
};
struct nodoPedido{
int codigo;
int monto;
char fecha[max_doce];
int codAlmacen;
int codProveedor;
struct nodoProveedor *ptrProveedor;
struct nodoDetallePedido *detalle;
struct nodoPedido *sgte;
};
typedef struct nodoProducto *Producto;
typedef struct nodoLinea *Linea;
typedef struct nodoCliente *Cliente;
typedef struct nodoDetalleVenta *DetalleVenta;
typedef struct nodoVenta *Venta;
typedef struct nodoProveedor *Proveedor;
typedef struct nodoPedido *Pedido;
typedef struct nodoDetallePedido *DetallePedido;
/*--------------------Funcion gotoxy -------------------*/
void gotoxy(int x,int y){
HANDLE hCon;
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X=x;
dwPos.Y=y;
SetConsoleCursorPosition(hCon,dwPos); }
/*------------------------------- TITULO PRINCIPAL --------------------------*/
void titulo(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Green);
cout<<"
_____________________________________________________________________"<<end
l;
cout<<"
|
____________________
|"<<endl;
cout<<"
|
| IBA\xA5"<<"EZ
|___________
|"<<endl;
cout<<"
|
XXXXXXXXXXXXXXXXXX
| FERNANDEZ SEGURA |
CORP ||"<<endl;
cout<<"
|
SISTEMA DE ALMACEN
| CASTILLO ALVA | INDUSRY
||"<<endl;
cout<<"
|
XXXXXXXXXXXXXXXXXX
| BENITES
| COMPANY
||"<<endl;
cout<<"
| ______________XXX________________| LUZURRIAGA
|
BUSINESS ||"<<endl;
cout<<"
| | _ _
+18 _ _ _ | __ ____ _ | ______ ||"<<endl;
cout<<"
| | | | | | _____ | | | | | | |
______
| | _ | ||"<<endl;
cout<<"
| | |_| |_| | | | |_| |_| |_| |
| ||
| | | | ||"<<endl;
cout<<"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
}
/*---------------------- MENU PRINCIPAL ----------------------*/
void menu1(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<<
SISTEMA DE ALMACEN
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
//
// //
// //////////"<<endl;
cout<<"
(1)ALMACEN
//
// ////
//
//"<<endl;
cout<<"
(2)CLIENTES
//
// // // //
//"<<endl;
cout<<"
(3)VENTAS
//
// // // //
//"<<endl;
cout<<"
(4)PROVEDORES
//
// // // //
//"<<endl;
cout<<"
(5)PEDIDOS
//
// //
///
//"<<endl;
cout<<"
(6)SALIR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*---------------------- MENU ALMACEN ----------------------*/
void menu2(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<<
ALMACEN
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
//
// //
// //////////"<<endl;
cout<<"
(1)REGISTRAR LINEA
//
// ////
//
//"<<endl;
cout<<"
(2)MOSTRAR LINEA
//
// // // //
//"<<endl;
cout<<"
(3)REGISTRAR PRODUCTO
//
// // // //
//"<<endl;
cout<<"
(4)MOSTRAR PRODUCTOS
//
// // // //
//"<<endl;
cout<<"
(5)REGRESAR
//
// //
///
//"<<endl;
cout<<"
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*---------------------- MENU CLIENTES ----------------------*/
void menu3(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<<
CLIENTES
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
(1)REGISTRAR
CLIENTE
//
// //
// //////////"<<endl;
cout<<"
//
// ////
//
//"<<endl;
cout<<"
(2)ACTUALIZAR CLIENTE
//
// // // //
//"<<endl;
cout<<"
//
// // // //
//"<<endl;
cout<<"
(3)LISTAR CLIENTES
//
// // // //
//"<<endl;
cout<<"
//
// //
///
//"<<endl;
cout<<"
(5)REGRESAR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*-------------------- MENU ACTUALIZAR CLIENTE ------------------*/
void menu_actualizar_cliente(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"\n\n
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<< CLIENTES -> MODIFICAR DATOS
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
//
// //
// //////////"<<endl;
cout<<"
(1)MODIFICAR NOMBRE
//
// ////
//
//"<<endl;
cout<<"
(2)MODIFICAR APELLIDOS
//
// // // //
//"<<endl;
cout<<"
(3)MODIFICAR TELEFONO
//
// // // //
//"<<endl;
cout<<"
(4)MODIFICAR E-MAIL
//
// // // //
//"<<endl;
cout<<"
(5)MODIFICAR DIRECCION
//
// //
///
//"<<endl;
cout<<"
(6)REGRESAR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*---------------------- MENU VENTAS ----------------------*/
void menu4(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<<
VENTAS
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
(1)VENDER
PRODUCTOS
//
// //
// //////////"<<endl;
cout<<"
//
// ////
//
//"<<endl;
cout<<"
(2)MOSTRAR VENTAS
REALIZADAS
//
// // // //
//"<<endl;
cout<<"
//
// // // //
//"<<endl;
cout<<"
(3)DETALLAR VENTA
//
// // // //
//"<<endl;
cout<<"
//
// //
///
//"<<endl;
cout<<"
(5)REGRESAR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*---------------------- MENU PROVEEDORES ---------------------*/
void menu5(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<<
PROVEEDORES
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
(1)REGISTRAR
PROVEEDOR
//
// //
// //////////"<<endl;
cout<<"
//
// ////
//
//"<<endl;
cout<<"
(2)ACTUALIZAR
PROVEEDOR
//
// // // //
//"<<endl;
cout<<"
//
// // // //
//"<<endl;
cout<<"
(3)LISTAR PROVEEDORES
//
// // // //
//"<<endl;
cout<<"
//
// //
///
//"<<endl;
cout<<"
(5)REGRESAR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*-------------------- MENU ACTUALIZAR PROVEEDOR ------------------*/
void menu_actualizar_proveedor(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<< PROVEEDORES -> MODIFICAR DATOS
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
//
// //
// //////////"<<endl;
cout<<"
(1)MODIFICAR RAZON
SOCIAL
//
// ////
//
//"<<endl;
cout<<"
(2)MODIFICAR TELEFONO
//
// // // //
//"<<endl;
cout<<"
(3)MODIFICAR E-MAIL
//
// // // //
//"<<endl;
cout<<"
(4)MODIFICAR DIRECCION
//
// // // //
//"<<endl;
cout<<"
(5)MODIFICAR WEB
//
// //
///
//"<<endl;
cout<<"
(6)REGRESAR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*---------------------- MENU PEDIDOS ----------------------*/
void menu6(void){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
---------------------------------------------------------------------\n";
cout<<"
<<<<<<<<<<
PEDIDOS
>>>>>>>>>>";
cout<<"\n
---------------------------------------------------------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
cout<<"
(1)REALIZAR UN
PEDIDO
//
// //
// //////////"<<endl;
cout<<"
//
// ////
//
//"<<endl;
cout<<"
(2)MOSTRAR PEDIDOS
REALIZADOS //
// // // //
//"<<endl;
cout<<"
//
// // // //
//"<<endl;
cout<<"
(3)DETALLAR PEDIDO
//
// // // //
//"<<endl;
cout<<"
//
// //
///
//"<<endl;
cout<<"
(5)REGRESAR
///////// //
//
//"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Red);
cout<<"
INFORMATICA - ESTRUCTURA DE
DATOS"<<endl; //SALIR DEL PROGRAMA
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Yellow);
cout<<"
Ingrese Opcion : ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
Color_Def);
}
/*-------------------- FUNCION PARA INSERTAR UNA LINEA --------------------*/
void insertar_linea(Linea &arbol, int x){
if(arbol==NULL){
arbol=new (struct nodoLinea);
arbol->codLinea=x;
cin.ignore();
cout<<"\n\tingrese descripcion:";
cin.getline(arbol->descripLinea,max_char);
arbol->enlace=NULL;
arbol->izq=NULL;
arbol->der=NULL;
}
else if(x<arbol->codLinea) insertar_linea(arbol->izq,x);
else if(x>arbol->codLinea) insertar_linea(arbol->der,x);
}
/*------------------ FUNCION PARA MOSTRAR TODAS LAS LINEAS -----------------*/
void mostrar_linea(Linea arbol){
if(arbol!=NULL){
mostrar_linea(arbol->izq);
cout<<"\n\t"<<arbol->codLinea<<"\t"<<arbol->descripLinea<<endl;
mostrar_linea(arbol->der);
}
}
/*------------ Funcion que inserta un nuevo producto a la linea
---------------------*/
void insertar_producto(Producto &q,int x){
if (q==NULL){
q=new(struct nodoProducto);
q->codProd=x;
cin.ignore();cout<<"\n\tNOMBRE:"; cin.getline(q>nomProd,max_char);
cout<<"\n\tPRECIO:"; cin>>q->precio;
q->izq=NULL;
q->der=NULL;
}
else if(x<q->codProd) insertar_producto(q->izq,x);
else if(x>q->codProd) insertar_producto(q->der,x);
}
/*---Funcion que busca el codigo de linea para agregar en el, el producto
ingresaro ----*/
void registrar_producto(Linea arbol, int cod){
if(arbol!=NULL){
if(arbol->codLinea==cod){
int x;
cout<<"\n\n\t\t[ REGISTRO DE PRODUCTO ]\n";
cout<<"\t\t------------------------";
cout<<"\n\tCODIGO:"; cin>>x;
insertar_producto(arbol->enlace,x);
}
else if(cod<arbol->codLinea) registrar_producto(arbol->izq,cod);
else if(cod>arbol->codLinea) registrar_producto(arbol->der,cod);
}
}
/*--------- Funcion que muestra todos los productos ingresados en una linea
------*/
void listar_productos(Producto q){
if(q!=NULL){
listar_productos(q->izq);
cout<<"\t"<<q->codProd<<"\t"<<q->nomProd<<"\t"<<q>precio<<endl;
listar_productos(q->der);
}
}
cout<<"\n\n\tCODIGO :"<<cliente->codCliente;
cout<<"\n\n\tNOMBRE :"<<cliente->nomCliente;
cout<<"\n\n\tAPELLIDOS :"<<cliente->apellCliente;
cout<<"\n\n\tDNI :"<<cliente->dniCliente;
cout<<"\n\n\tRUC :"<<cliente->rucCliente;
cout<<"\n\n\tTELEFONO :"<<cliente->telefono;
cout<<"\n\n\tDIRECCION :"<<cliente->direccion;
cout<<"\n\n\tE-MAIL :"<<cliente->email;
menu_actualizar_cliente();
cin>>op;
switch(op){
case 1: cin.ignore();
cout<<"\n\tINGRESE NUEVO NOMBRE :";
cin.getline(cliente->nomCliente,max_char);
break;
case 2: cin.ignore();
cout<<"\n\tINGRESE NUEVO APELLIDO :";
cin.getline(cliente->apellCliente,max_char);
break;
case 3: cin.ignore();
cout<<"\n\tINGRESE NUEVO TELEFONO :";
cin.getline(cliente->telefono,max_doce);
break;
case 4: cin.ignore();
cout<<"\n\tINGRESE NUEVO E-MAIL :";
cin.getline(cliente->email,max_char);
break;
case 5: cin.ignore();
cout<<"\n\tINGRESE NUEVA DIRECCION :";
cin.getline(cliente->direccion,max_char);
break;
case 6: break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n"; break;
}
}
else if(cod<cliente->codCliente) actualizar_cliente(cliente->izq,cod);
else if(cod>cliente->codCliente) actualizar_cliente(cliente->der,cod);
}
}
/*---------- Funcion que muestra todos los clientes registrados ---------*/
void mostrar_clientes(Cliente cliente){
if(cliente!=NULL){
mostrar_clientes(cliente->izq);
cout<<"\n\n\t\t[ MOSTRAR CLIENTES ]\n";
cout<<"\t\t------------------------";
cout<<"\n\n\tCODIGO :"<<cliente->codCliente;
cout<<"\n\n\tNOMBRE :"<<cliente->nomCliente;
cout<<"\n\n\tAPELLIDOS :"<<cliente->apellCliente;
cout<<"\n\n\tDNI :"<<cliente->dniCliente;
cout<<"\n\n\tRUC :"<<cliente->rucCliente;
cout<<"\n\n\tTELEFONO :"<<cliente->telefono;
cout<<"\n\n\tDIRECCION :"<<cliente->direccion;
cout<<"\n\n\tE-MAIL :"<<cliente->email;
mostrar_clientes(cliente->der);
}
}
/*------- Funcion que retorna true cuando el codigo es valido --------*/
bool validar_codigo_cliente(Cliente cliente, int cod, Cliente &ptrCliente){
if(cliente!=NULL){
if(cliente->codCliente==cod){
ptrCliente=cliente;
return true;
}
else if(cod<cliente->codCliente) validar_codigo_cliente(cliente>izq,cod,ptrCliente);
else if(cod>cliente->codCliente) validar_codigo_cliente(cliente>der,cod,ptrCliente);
}
}
/*------- Funcion que valida si el codigo del producto es verdadero--------*/
bool validar_cod_producto(Producto producto, int codprod, Producto
&puntProducto){
if(producto!=NULL){
if(producto->codProd==codprod){
puntProducto=producto;
return true;
}
else if(codprod<producto->codProd) validar_cod_producto(producto>izq,codprod,puntProducto);
else if(codprod>producto->codProd) validar_cod_producto(producto>der,codprod,puntProducto);
}
}
/*------- Funcion que busca el codigo de linea del producto en el arbol --------*/
bool validar_codigo_producto(Linea arbol,int codlinea, int codprod, Producto
&puntProducto){
bool validar;
validar=false;
if(arbol!=NULL){
if(arbol->codLinea==codlinea){
validar=validar_cod_producto(arbol->enlace,codprod,puntProducto);
if (validar==true)
return validar;
}
else if(codlinea<arbol->codLinea) validar_codigo_producto(arbol>izq,codlinea,codprod,puntProducto);
else if(codlinea>arbol->codLinea) validar_codigo_producto(arbol>der,codlinea,codprod,puntProducto);
}
}
/*------- Funcion que agrega un producto a la boleta de venta --------*/
void insertar_producto_venta(DetalleVenta &q,Linea arbol){
bool validado;
int codLinea,x;
char op;
DetalleVenta t,r;
r=new(struct nodoDetalleVenta);
cout<<"\n\tCODIGO:";
cin>>r->codigo;
r->ptrProducto=NULL;
validado=false;
do{
cout<<"\n\tINGRESE LINEA DEL PRODUCTO: ";
cin>>codLinea;
cout<<"\n\tCODIGO DE PRODUCTO:";
cin>>x;
validado=validar_codigo_producto(arbol,codLinea,x,r->ptrProducto);
if(validado==true){
cout<<"\n\t NOMBRE :"<<(r->ptrProducto)->nomProd;
cout<<"\n\t PRECIO :"<<(r->ptrProducto)->precio;
}
if(validado==false){
cout<<"\n\tCODIGO INVALIDO...!!";
}
cout<<"\n\n\tDesea continuar ? <y/n>: ";
cin>>op;
switch(op){
case 'y': break;
}
}while(op=='y'||op=='Y');
}
/*------- Funcion que registra una venta a la lista enlazada venta --------*/
void registrar_venta(Venta &venta,Cliente cliente, Linea arbol){
int x; char op;
float total=0;
bool validado;
Venta q,t;
DetalleVenta aux;
q=new(struct nodoVenta);
cout<<"\n\n\t\t[ BOLETA DE VENTAS ]\n";
cout<<"\t\t------------------------";
cout<<"\n\tCODIGO:";
cin>>q->codigo;
cin.ignore(); cout<<"\n\tFECHA:"; cin.getline(q->fecha,max_doce);
validado=false;
do{
cout<<"\n\tCODIGO DE CLIENTE:";
cin>>x;
validado=validar_codigo_cliente(cliente,x,q->ptrCliente);
if(validado==true)
cout<<"\n\tNOMBRE:"<<(q->ptrCliente)->nomCliente;
if(validado==false)
cout<<"\n\tCODIGO INVALIDO...!!";
cout<<"\n\n\tDesea continuar con el registro de venta ? <y/n>: ";
cin>>op;
switch(op){
case 'y': break;
case 'Y': break;
case 'n': delete(q);
return ;
case 'N': delete(q);
return ;
default: cout<<"\n\t Ingrese una opcion valida";
}
}while(validado==false);
q->codCliente=x;
q->detalle=NULL;
q->sgte=NULL;
detalle_de_venta(q->detalle,arbol,q);//insertamos los productos deseados
/*--- calculamos el monto */
aux=q->detalle;
while(aux!=NULL){
total=total+aux->subtotal;
aux=aux->sgte;
}
q->monto=total;
if(venta==NULL)
venta=q;
else {
t=venta;
while(t->sgte!=NULL)
t=t->sgte;
t->sgte=q;
}
}
/*------- Funcion muestra todas las ventas de la lista q --------*/
void listar_ventas(Venta q){
int i=1;
while(q!=NULL){
cout<<"\n\n\tDATOS DE LA VENTA ["<<i<<"] ";
cout<<"\n\t------------------------";
cout<<"\n\tCODIGO DE VENTA: "<<q->codigo;
cout<<"\n\tFECHA : "<<q->fecha;
cout<<"\n\tCODIGO DE CLIENTE : "<<q->codCliente;
cout<<"\n\tNOMBRE DEL CLIENTE:"<<(q->ptrCliente)->nomCliente;
cout<<"\n\tMONTO:"<<q->monto;
q=q->sgte;
i++;
}
}
/*------- Funcion que muestra una venta con sus productos --------*/
void mostrar_venta(Venta q, int cod){
int i=1;
while(q!=NULL){
if(q->codigo==cod){
cout<<"\n\n\t[ DATOS DE LA VENTA ]";
cout<<"\n\t------------------------";
cout<<"\n\tCODIGO DE VENTA: "<<q->codigo;
cout<<"\n\tFECHA : "<<q->fecha;
cout<<"\n\tCODIGO DE CLIENTE : "<<q->codCliente;
cout<<"\n\tNOMBRE DEL CLIENTE:"<<(q->ptrCliente)->nomCliente;
cout<<"\n\tMONTO:"<<q->monto<<endl;
while(q->detalle!=NULL){
cout<<"\n\n\tPRODUCTO ["<<i<<"]\n";
cout<<"\n\tCODIGO:"<<(q->detalle)->codigo;
cout<<"\n\tCODIGO DEL PRODUCTO:"<<(q->detalle)->codProd;
cout<<"\n\tCANTIDAD:"<<(q->detalle)->cantidad;
cout<<"\n\tMARCA:"<<(q->detalle)->ptrProducto->nomProd;
cout<<"\n\tSUBTOTAL:"<<(q->detalle)->subtotal;
(q->detalle)=(q->detalle)->sgte;
i++;
}
q=q->sgte;
}
else q=q->sgte;
}
}
/*----------------- Funcion para registrar proveedores ---------------*/
void registrar_proveedor(Proveedor &proveedor, int x){
if(proveedor==NULL){
proveedor=new (struct nodoProveedor);
proveedor->codProveedor=x;
cin.ignore(); cout<<"\n\tRAZON SOCIAL :"; cin.getline(proveedor>razonSocial,max_char);
cin.ignore(); cout<<"\n\tRUC :"; cin.getline(proveedor>rucProveedor,max_doce);
cin.ignore(); cout<<"\n\tTELEFONO :"; cin.getline(proveedor>telefono,max_doce);
cin.ignore(); cout<<"\n\tDIRECCION :"; cin.getline(proveedor>direccion,max_char);
cin.ignore(); cout<<"\n\tE-MAIL :"; cin.getline(proveedor>email,max_char);
cin.ignore(); cout<<"\n\tWEB :"; cin.getline(proveedor->web,max_char);
proveedor->izq=NULL;
proveedor->der=NULL;
}
else if(x<proveedor->codProveedor) registrar_proveedor(proveedor>izq,x);
else if(x>proveedor->codProveedor) registrar_proveedor(proveedor>der,x);
}
/*------- Funcion que modifica un dato de un proveedor seleccionado --------*/
void actualizar_proveedor(Proveedor &proveedor,int cod){
if(proveedor!=NULL){
if(proveedor->codProveedor==cod){
int op;
system("cls");
cout<<"\n\n\t\t[ MODIFICAR CLIENTE ]\n";
cout<<"\t\t------------------------";
cout<<"\n\n\tCODIGO :"<<proveedor->codProveedor;
cout<<"\n\n\tRAZON SOCIAL :"<<proveedor->razonSocial;
cout<<"\n\n\tRUC :"<<proveedor->rucProveedor;
cout<<"\n\n\tTELEFONO :"<<proveedor->telefono;
cout<<"\n\n\tDIRECCION :"<<proveedor->direccion;
cout<<"\n\n\tE-MAIL :"<<proveedor->email;
cout<<"\n\n\tWEB :"<<proveedor->web;
menu_actualizar_proveedor();
cin>>op;
switch(op){
case 1: cin.ignore();
cout<<"\n\tINGRESE NUEVA RAZON SOCIAL :";
cin.getline(proveedor->razonSocial,max_char);
break;
case 2: cin.ignore();
cout<<"\n\tINGRESE NUEVO TELEFONO :";
cin.getline(proveedor->telefono,max_doce);
break;
case 3: cin.ignore();
cout<<"\n\tINGRESE NUEVO E-MAIL :";
cin.getline(proveedor->email,max_char);
break;
case 4: cin.ignore();
cout<<"\n\tINGRESE NUEVA DIRECCION :";
cin.getline(proveedor->direccion,max_char);
break;
case 5: cin.ignore();
cout<<"\n\tINGRESE NUEVA WEB :";
cin.getline(proveedor->web,max_char);
break;
case 6: break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n"; break;
}
}
else if(cod<proveedor->codProveedor)
actualizar_proveedor(proveedor->izq,cod);
else if(cod>proveedor->codProveedor)
actualizar_proveedor(proveedor->der,cod);
}
}
/*---------- Funcion que muestra todos los proveedores registrados ---------*/
void mostrar_proveedores(Proveedor proveedor){
if(proveedor!=NULL){
mostrar_proveedores(proveedor->izq);
}
if(validado==false)
cout<<"\n\tCODIGO INVALIDO...!!";
cout<<"\n\n\tDesea continuar ? <y/n>: ";
cin>>op;
switch(op){
case 'y': break;
case 'Y': break;
case 'n': return ;
case 'N': return ;
default: cout<<"\n\t Ingrese una opcion valida";
}
}while(validado==false);
r->codProd=x;
cout<<"\n\tCANTIDAD:";
cin>>r->cantidad;
strcpy(r->marca,(r->ptrProducto)->nomProd);
r->subtotal=(r->cantidad)*((r->ptrProducto)->precio);
r->sgte=NULL;
if(q==NULL)
q=r;
else{
t=q;
while(t->sgte!=NULL)
t=t->sgte;
t->sgte=r;
}
}
/*------- Funcion que ordena agregar la cantidad de productos deseados al
detalle del pedido --------*/
void detalle_de_pedido(DetallePedido &detalle,Linea arbol,Pedido &pedido){
char op;
cout<<"\n\n\t\t[ LISTA DE PRODUCTOS A PEDIR ]\n";
cout<<"\t\t-------------------------------";
do{
insertar_producto_pedido(detalle,arbol);
cout<<"\n\n\tDesea agregar otro producto a la Proforma ? <y/n>: ";
cin>>op;
switch(op){
if(validado==false)
cout<<"\n\tCODIGO INVALIDO...!!";
cout<<"\n\n\tDesea continuar con el registro de Pedido ? <y/n>: ";
cin>>op;
switch(op){
case 'y': break;
case 'Y': break;
case 'n': delete(q);
return ;
case 'N': delete(q);
return ;
default: cout<<"\n\t Ingrese una opcion valida";
}
}while(validado==false);
q->codProveedor=x;
q->detalle=NULL;
q->sgte=NULL;
detalle_de_pedido(q->detalle,arbol,q);//insertamos los productos
deseados
/*--- calculamos el monto */
aux=q->detalle;
while(aux!=NULL){
total=total+aux->subtotal;
aux=aux->sgte;
}
q->monto=total;
if(pedido==NULL)
pedido=q;
else {
t=pedido;
while(t->sgte!=NULL)
t=t->sgte;
t->sgte=q;
}
}
/*------- Funcion que muestra un pedido con sus productos --------*/
void mostrar_pedido(Pedido q, int cod){
int i=1;
while(q!=NULL){
if(q->codigo==cod){
cout<<"\n\n\t[ DATOS DEL PEDIDO ]";
cout<<"\n\t------------------------";
case 2: mostrar_linea(arbol);
break;
case 3: cout<<"\nIngrese codigo de Linea del
Producto:";
cin>>dato;
registrar_producto(arbol,dato);
break;
case 4: cout<<"\nIngrese codigo de Linea del
Producto:";
cin>>dato;
mostrar_producto(arbol,dato);
break;
case 5: break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n";
break;
}
cout<<endl;
system("pause"); system("cls");
}while(op2!=5);
break;
/*------------- CLIENTES ---------------*/
case 2: system("cls");
do{
titulo();
menu3();
cin>>op2;
switch(op2){
case 1: cout<<"\n\n\t\t[ REGISTRO DE CLIENTE ]\n";
cout<<"\t\t------------------------\n";
cout<<"\n\tCodigo de cliente:";
cin>>dato;
registrar_cliente(cliente,dato);
break;
case 2: cout<<"\n\n\t\t[ ACTUALIZAR CLIENTE ]\n";
cout<<"\t\t------------------------\n";
cout<<"\n\tCodigo de cliente:";
cin>>dato;
actualizar_cliente(cliente,dato);
break;
case 3: system("cls");
mostrar_clientes(cliente);
break;
case 5: break;
]\n";
case 5: break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n";
break;
}
cout<<endl;
system("pause"); system("cls");
}while(op2!=5);
break;
/*------------- PROVEEDOR ---------------*/
case 4: system("cls");
do{
titulo();
menu5();
cin>>op2;
switch(op2){
case 1: cout<<"\n\n\t\t[ REGISTRO DE
PROVEEDOR ]\n";
cout<<"\t\t------------------------\n";
cout<<"\n\tCodigo de Proveedor:";
cin>>dato;
registrar_proveedor(proveedor,dato);
break;
case 2: cout<<"\n\n\t\t[ ACTUALIZAR PROVEEDOR ]\n";
cout<<"\t\t------------------------\n";
cout<<"\n\tCodigo de Proveedor:";
cin>>dato;
actualizar_proveedor(proveedor,dato);
break;
case 3: system("cls");
mostrar_proveedores(proveedor);
break;
case 5: break;
default: cout<<"\nINGRESE UNA OPCION VALIDA...\n";
break;
}
cout<<endl;
system("pause"); system("cls");
}while(op2!=5);
break;
/*------------- PEDIDOS ---------------*/
case 5: system("cls");
do{
titulo();
menu6();
cin>>op2;
switch(op2){
case 1: registrar_pedido(pedido,proveedor,arbol);
break;
case 2: cout<<"\n\n\t\t[ LISTAR PEDIDOS
REALIZADOS ]\n";
cout<<"\t\t------------------------\n";
listar_pedidos(pedido);
break;
case 3: cout<<"\n\n\t\t[ DETALLES DE PEDIDO
cout<<"\t\t------------------------\n";
cout<<"\n\tIngrese codigo de pedido:";
cin>>dato;
mostrar_pedido(pedido,dato);
break;
case 5: break;
]\n";