ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Proyeto biblioteca c++


Enviado por   •  20 de Noviembre de 2022  •  Trabajos  •  23.330 Palabras (94 Páginas)  •  43 Visitas

Página 1 de 94

//Encabezado del programa con las librerias

#include<stdio.h>

#include<conio.h>

#include<iostream>

#include<windows.h>

#include<time.h>

#include<stdlib.h>

#include<math.h>

#include<string.h>

using namespace std;

class Persona //CLASE PRINCIPAL O CLASE PADRE DEL PROGRAMA

{

protected: //PROTECTED ES EL PARÀMETRO PREDEFINIDO, PARA ESTABLECER QUE LOS ATRIBUTOS DEL PROGRAMA PUEDEN MODIFICAR LOS DATOS DE LOS ATRIBUTOS

//ATRIBUTOS DE LA CLASE PADRE

int edad;

char estado_civil;

string nombre;

public: //PUBLIC INDICA QUE LO SIGUIENTE EN LA CLASE SON LOS PARÀMETROS,Y QUE SON MAS ACCESIBLES QUE LOS ATRIBUTOS

//METODOS O FUNCIONES DE LA CLASE PADRE

Persona(int e, char ec, string n); //->METODO CONSTRUCTOR DE LA CLASE PADRE

virtual void Mostrar();

};

//INICIALIZACION DEL CONSTRUCTOR

Persona::Persona(int e, char ec, string n)

{

edad = e;

estado_civil = ec;

nombre = n;

}

//INICIALIZACION DEL MÈTODO MOSTRAR ()

void Persona::Mostrar()

{

cout << "EDAD = " << edad << "\n ESTADO CIVIL = " << estado_civil <<"\n NOMBRE = " << nombre;

}

class Cliente: public Persona // CLIENTE ES LA CLASE HIJA DE CLASE PERSONA, A TRAVÈS DE HERENCIA OBTIENE SUS ATRIBUTOS Y MÈTODOS

{

private: //ENCAPSULAMIENTO DE LOS ATRIBUTOS DE LA CLASE CLIENTE

int ocupacion;

int num_cedula;

public:

Cliente(int e, char ec, string n, int ocup, int num); //->MÈTODO CONSTRUCTOR DE LA CLASE HIJA

void Mostrar();

};

//INICIALIZADOR DEL MÈTODO CONSTRUCTOR DE LA CLASE HIJA

//EXPONIENDO LOS ATRIBUTOS DE LA CLASE PADRE , Y TAMBIÈN LOS NUEVOS DE LA CLASE HIJA

Cliente::Cliente(int e, char ec, string n, int ocup, int num):Persona(e,ec,n)

{

ocupacion = ocup;

num_cedula = num;

}

//INICIALIZADOR DEL MÈTODO MOSTRAR DE LA SUB-CLASE "CLIENTE"

void Cliente::Mostrar(){

Persona::Mostrar();

cout << "\n Ocupacion = " << ocupacion << "\n Numero de cedula = " << num_cedula << endl;

}

class Libro{

protected:

int codigo,anio,num_pags;

string adquirido,titulo,autor,editorial,lugar;

public:

Libro(int _cod,int _anio,int _num,string _adq,string _titulo,string _aut,string _edit,string _lug);

virtual void MostrarDatos();

};

Libro::Libro(int _cod,int _anio,int _num,string _adq,string _titulo,string _aut,string _edit,string _lug)

{

codigo=_cod;

anio=_anio;

num_pags=_num;

adquirido=_adq;

titulo=_titulo;

autor=_aut;

editorial =_edit;

lugar=_lug;

}

void Libro::MostrarDatos()

{

cout << "\nCODIGO = " <<codigo<< "\n ANIO = " <<anio<<"\n NUMERO DE PAGINAS = " << num_pags<< "\nADQUIRIDO = " << adquirido << "\n TITULO = " << titulo <<"\n AUTOR = " << autor<< "\nEDITORIAL = " << editorial << "\n LUGAR = " << lugar;

}

//OPCION 4 VARIABLES

int dip=0,mep=0,anp=0;

int dif=0,mef=0,anf=0;

int dias_totales1=0,dias_totales2=0,dias_totales3=0;

//INICIO FUNCION PRINCIPAL

int main(){

//

...

Descargar como (para miembros actualizados)  txt (64.3 Kb)   pdf (90.5 Kb)   docx (31.4 Kb)  
Leer 93 páginas más »
Disponible sólo en Clubensayos.com