ABC
 All Classes Files Functions Variables Pages
RegTelefonico.hpp
Go to the documentation of this file.
1 #ifndef __RegTelefonico__
2 #define __RegTelefonico__
3 
4 #include "Registro.hpp"
5 #include <string>
6 #include <stdio.h>
7 
8 using namespace std;
9 
10 
12 
20 class RegTelefonico : public Registro
21 {
22 
23 private:
24 
25  string Nombre;
26  string Direccion;
27  string Telefonos;
28 
29 
30 
31 public:
32 
33 
34 
40  {
41  }
42 
43 
44 
47  {
48  printf("\n\nNombre: %s", Nombre.c_str());
49  printf("\nDireccion: %s", Direccion.c_str());
50  printf("\nTelefonos: %s", Telefonos.c_str());
51  return 0; //Ok
52  }
53 
55  int AdicionaRegistro(void)
56  {
57  // Cadena temporal
58  char cad[81];
59 
60  printf("\nNombre: ");
61  ut.leerCadena(cad, 80);
62  Nombre.assign(cad);
63 
64 
65  printf("\nDireccion: ");
66  ut.leerCadena(cad, 80);
67  Direccion.assign(cad);
68 
69  printf("\nTelefonos: ");
70  ut.leerCadena(cad, 80);
71  Telefonos.assign(cad);
72 
73  return 0; // Ok
74  }
75 
78  {
79  // Cadena temporal
80  char cad[81];
81 
82  // Visualiza el nombre y permite su modificacion
83  printf("\nNombre: %s", Nombre.c_str());
84  printf("\nNuevo Nombre: ");
85  ut.leerCadena(cad, 80);
86  Nombre.assign(cad);
87 
88  printf("\nDireccion: %s", Direccion.c_str());
89  printf("\nNueva Direccion: ");
90  ut.leerCadena(cad, 80);
91  Direccion.assign(cad);
92 
93  printf("\nTelefonos: %s", Telefonos.c_str());
94  printf("\nNuevos Telefonos: ");
95  ut.leerCadena(cad, 80);
96  Telefonos.assign(cad);
97 
98  return 0; // Ok
99  }
100 
102  int LeerRegistro(FILE *file)
103  {
104  char cad[100];
105 
106  cad[0] = 0;
107  fread(cad,1,80,file);
108  Nombre.assign(cad);
109 
110  fread(cad,1,80,file);
111  Direccion.assign(cad);
112 
113 
114  fread(cad,1,80,file);
115  Telefonos.assign(cad);
116 
117  return 0; // Ok
118  }
119 
121  int GrabarRegistro(FILE *file)
122  {
123  fwrite(Nombre.c_str(),1,80,file);
124  fwrite(Direccion.c_str(),1,80,file);
125  fwrite(Telefonos.c_str(),1,80,file);
126 
127  return 0; // Ok
128  }
129 
130 };
131 
132 
133 #endif
int AdicionaRegistro(void)
Modifica el contenido del registro.
Definition: RegTelefonico.hpp:55
int ModificarRegistro(void)
Modifica el contenido del registro.
Definition: RegTelefonico.hpp:77
int GrabarRegistro(FILE *file)
Graba un registro.
Definition: RegTelefonico.hpp:121
int LeerRegistro(FILE *file)
Leer un registro.
Definition: RegTelefonico.hpp:102
Clase Base para manipular registros.
Definition: Registro.hpp:17
string Telefonos
Definition: RegTelefonico.hpp:27
Clase para manipular registros telefonicos.
Definition: RegTelefonico.hpp:20
string Direccion
Definition: RegTelefonico.hpp:26
RegTelefonico(void)
Definition: RegTelefonico.hpp:39
string Nombre
Definition: RegTelefonico.hpp:25
int VisualizaRegistro(void)
Visualiza el contenido del registro.
Definition: RegTelefonico.hpp:46