C/Visual C - ayuda con este codigo

 
Vista:

ayuda con este codigo

Publicado por junade (1 intervención) el 15/09/2014 18:33:45
Me ayudas con este programa tengo problemas con las bajas de antemano gracias
compilado devc++

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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <conio.h>
 
# define x 10
 
struct fecha{
	int dd;
	int mm;
	int aa;
	};
 
struct datosmedico{
	char cm[5];
	char nm[60];
	char esp[40];
	fecha fi;
	int status;
	};
 
struct datospaciente {
	char cp[5];
	char np[60];
	char dx[40];
	int status;
	};
using namespace std;
main ()
{
	datosmedico dms[x];  //variable arreglo de estructuras
	datospaciente dps[x];
	int i,j=0, k, encontrado;
	char resp,op,opm,opp;
	char cmb[5], cpb[5], rbm, rbp;
 
	do{
system ("cls");
 
        cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
		cout<<"DOMICILIO CONOCIDO S/N"<<endl;
 
		cout<<"\n\t\t M E N U P R I N C I P A L";
		cout<<"\n\t\t Sistema computacional ABC";
 
		cout<<"\n\t M] edicos";
		cout<<"\n\t P] acientes";
		cout<<"\n\t S] alir";
		cout<<"\n\t Digite Su Respuesta: ";
		cin>>op;
 
		switch (op){
			case 77:
			case 109:
				do {
					system("cls");
					cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
					cout<<"DOMICILIO CONOCIDO S/N"<<endl;
 
					cout<<"M E N U  M E D I C O S"<<endl;
 
					cout<<"\n\t A] ltas";
					cout<<"\n\t B] ajas";
					cout<<"\n\t C] onsultas";
					cout<<"\n\t R] eportes";
					cout<<"\n\t M] odificaciones";
					cout<<"\n\t V] olver";
					cout<<"\n\t Digite Su Respuesta: ";
					fflush(stdin);
					cin>>opm;
 
					switch (opm){
						case 65:        // ALTAS
						case 97:
 
								j=0;
								do{
									system("cls");
									cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
									cout<<"DOMICILIO CONOCIDO S/N"<<endl;
									cout<<"\n Modulo Altas Medico"<<endl;
 
									cout<<"\n Escribe El Codigo Del Medico: ";
														fflush(stdin);
														gets(dms[j].cm);
 
														cout<<"\n Escribe El Nombre: ";
														fflush(stdin);
														gets(dms[j].nm);
 
														cout<<"\nEspecialidad: ";
														fflush(stdin);
														gets(dms[j].esp);
 
														cout<<"\nEscribe La Fecha De Su Ingreso";
														cout<<"\nDia: ";
														cin>>dms[j].fi.dd;
														cout<<"\nMes: ";
														cin>>dms[j].fi.mm;
														cout<<"\nAño: ";
														cin>>dms[j].fi.aa;
 
 
														dms[j].status = 1;
 
														cout<<endl<<endl<<" Deseas Registrar Otro Medico [S/N]:? ";
														fflush(stdin);//limpia buffer
														cin>>resp;
									system("cls");
									j++;
								} while(resp!='N' && resp!= 'n');
								break;
 
						case 82 :     //REPORTES
						case 114 :
 
							system("cls");
							cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
							cout<<"DOMICILIO CONOCIDO S/N"<<endl;
							cout<<"\n Modulo Reportes Medicos"<<endl;
 
							for(i=0;i<j;i++)
								{
								cout<<endl;
								cout<<"\n La informacion almacenada de la persona "<<i+1<<" en la estructura es: ";
								cout<<"\nCodigo Medico: "<<dms[i].cm;
								cout<<"\nNombre: "<<dms[i].nm;
								cout<<"\nEspecialidad: "<<dms[i].esp;
 
								cout<<"\nFECHA DE INGRESO:"<<endl;
								cout<<"\nDia: "<<dms[i].fi.dd;
								cout<<"\nMes: "<<dms[i].fi.mm;
								cout<<"\nAño: "<<dms[i].fi.aa;
 
								cout<<"\nStatus: " <<dms[i].status;
 
								cout<<endl;
								}
							cout<<endl<<endl<<"Presione cualquier tecla para regresar...";
							getch( );
							break;
 
						case 66 :  //BAJAS
						case 98 :
							system("cls");
							cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
							cout<<"DOMICILIO CONOCIDO S/N"<<endl;
							cout<<"\n\nMODULO DE BAJAS (Logicas) MEDICOS"<<endl<<endl;
 
							cout<<"Ingresa el codigo del medico a dar de baja: ";
							fflush(stdin);
							gets(cmb);
 
							k = 0;
							encontrado = 0;
							while( !strcmp(cmb, dms[k].cm) && !encontrado ){
								cout<<endl<<endl<<"Se encontro lo siguente: "<<endl<<endl;
								cout<<"\nCodigo Medico: "<<dms[k].cm;
								cout<<"\nNombre: "<<dms[k].nm;
								cout<<"\nEspecialidad: "<<dms[k].esp;
 
								cout<<"\nFECHA DE INGRESO:"<<endl;
								cout<<"\nDia: "<<dms[k].fi.dd;
								cout<<"\nMes: "<<dms[k].fi.mm;
								cout<<"\nAño: "<<dms[k].fi.aa;
 
								encontrado = 1;
								cout<<endl<<endl<<"Desea darlo de baja [ S/N ]: ";
								fflush(stdin);
								cin>>rbm;
 
								if( rbm != 78 && rbm != 110){
									dms[k].status = 0;
									cout<<endl<<endl<<"El registro ha sido dado de baja...";
									getch();
									}
 
								if ( !encontrado ){
									cout<<endl<<endl<<"No se encontro informacion...";
									getch();
									}
								k++;
								}
							break;
 
 
 
 
 
						default :
								system("cls");
								cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
								cout<<"DOMICILIO CONOCIDO S/N"<<endl;
								cout<<"\n\n Opcion no valida!"<<endl;
								getch();
					} //switch() medicos
			  } while (opm != 86 && opm != 118);
 
			default :
					system("cls");
					cout<<"HOSPITAL DE LOS ANGELES S.A. DE C.V."<<endl;
					cout<<"DOMICILIO CONOCIDO S/N"<<endl;
					cout<<"\n\n Opcion no valida!"<<endl;
					getch();
			} // switch() menu principal
 
		}while (op != 115 && op != 83 );
	system("cls");
	return 0;
	}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder