Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <stdio.h>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. class dvds{
  9.     private:
  10.     int numero;
  11.     char nombre[20];
  12.  
  13.     public:
  14.     dvds(){nombre[19]=0;}
  15.  
  16.     void meter (int num, char nom[20]);
  17.     void mostrar();
  18.     ~dvds(){} ;
  19. };
  20.  
  21.  
  22. void dvds::meter(int num, char nom[20])
  23. {
  24.     numero =num;
  25.     strcpy(nombre,nom);
  26. }
  27. void dvds::mostrar()
  28. {
  29.     cout<<"Numero:"<<numero<<endl;
  30.     cout<<"Nombre:"<<nombre<<endl;
  31.  
  32. }
  33.  
  34.  
  35. int main()
  36. {
  37.     dvds dvd;
  38.     int num;
  39.     char nom[20];
  40.     cout<<"\n ingresa numero";
  41.     cin>>num;
  42.     cout << (int) nom << endl;
  43.     cout<<"\n ingresa nombre";
  44.     cin>>nom[20]; nom[19]=0;
  45.  
  46.     dvd.meter(num, nom);
  47.     dvd.mostrar();
  48.  
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement