Dev - C++ - sumar dias a una fecha y obtener la resultante

 
Vista:
sin imagen de perfil

sumar dias a una fecha y obtener la resultante

Publicado por giuli (3 intervenciones) el 01/06/2015 20:21:22
Necesito sumarle 30 dias a la fecha prestamo para obtener la fechadevolucion en un sistema bibliotecario.
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
#include <iostream>
#include <time.h>
#include <vector>
#define MY_GLOBAL_FUN
 
    struct tm* damefecha(struct tm* valor){
 
         valor->tm_mday += 30;
 
         return(valor);
};
 
 
using namespace std;
 
class Autor{
      private:
      string Nombre;
      string Nacionalidad;
      time_t fechaNac;
      public:
             Autor(string NombreA, string NacionalidadA, time_t fechaNacA){
                          Nombre=NombreA;
                          Nacionalidad=NacionalidadA;
                          fechaNac=fechaNacA;
             };
      };
class Libro{
      private:
             string titulo;
             string editorial;
             int ano;
             Autor *autor;
 
      public:
             Libro::Libro(string tituloL,string editorialL, int anoL,string tipoL){
                                titulo=tituloL;
                                editorial=editorialL;
                                ano=anoL;
 
 
                                 };
             void setAutor(Autor *A1){
 
                  this->autor=A1;
                  };
      };
class Copia{
      private:
              int identificador;
              string estado;
              Libro *L1;
      public:
             int x;
 
 
            Copia::Copia(int identificadorC, string estadoC,Libro L1C){
                           identificador=identificadorC;
                           estado=estadoC;
 
                           };
            string getEstado(){
 
                   return (estado);
 
                   };
            void setEstado(string nuevoEstado){
                 estado=nuevoEstado;
 
                 };
 
      };
class Prestamo{
      private:
              struct tm* fechaPrestamo;
              struct tm* fechaDevolucion;
 
      public:
 
             Prestamo::Prestamo(struct tm* fechaPrestamoP){
                                       fechaPrestamo=fechaPrestamoP;
 
             };
 
           struct tm* getFechaDevolucion(){return  damefecha(fechaPrestamo);};
            void setfechaDevolucion(struct tm* fechanueva){fechaDevolucion=fechanueva;};
      };
class Lector{
      private:
              string nombre;
              int prestamos;
      public:
             Prestamo *P1;
             Lector::Lector(string nombreL,int prestamosL){
                                   nombre=nombreL;
                                   prestamos=prestamosL;
             };
             void setprestamos(int a){
                  prestamos=prestamos + a;
 
             };
             void solicitarPrestamo(Copia *C1){
                  if (C1->getEstado()=="biblioteca"){
                                                  if (this->prestamos<3) {
                                                                      P1 = new Prestamo(29/05/15);
                                                                      C1->setEstado("prestado");
                                                                      cout<<(P1->getFechaDevolucion());
                                                                      setprestamos(1);
                                                                      }
                                                  else{
                                                                            cout<<"llego al limite"<<endl;
                                                                            };
                  }else{
                                                       cout<<"libro no disponible"<<endl;
                                                        };
                  };
      };
 
//string estados[4]={"prestado","biblioteca","retraso","reparacion"};
//string tipos[4]={};
int main(){
 
 
    int a;
    Libro *L1=new Libro("Martin Fierro","Columba",1835,"poesia");
    Libro *L2=new Libro("El quijote","Española",1500,"novela");
    Autor *A1=new Autor("jose","hernandez",12-4-1825);
    Autor *A2=new Autor("Cervantes","Saavedra",11-8-1499);
    L1->setAutor(A1);
    Copia *C1=new Copia(1,"biblioteca",*L1);
    Copia *C2=new Copia(2,"prestado",*L2);
    Lector *Lector1=new Lector("Giuli",2);
 
 
 
     cout<<("libros en biblioteca: 1- Martin Fierro 2 -El quijote")<<endl;
    cout<<("3-salir")<<endl;
 
    cin>>a;
do{
 
    switch (a)
 
    case 1:
 
 Lector1->solicitarPrestamo(C1);
 
       break;
 
 
    }while (a!=3);
    system("pause");
    return 0;
 
};
Ahi esta el codigo pero se tilda el sistema.. gracias por su ayuda
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