Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <stdio.h>
- using namespace std;
- class dvds{
- private:
- int numero;
- char nombre[20];
- public:
- dvds(){nombre[19]=0;}
- void meter (int num, char nom[20]);
- void mostrar();
- ~dvds(){} ;
- };
- void dvds::meter(int num, char nom[20])
- {
- numero =num;
- strcpy(nombre,nom);
- }
- void dvds::mostrar()
- {
- cout<<"Numero:"<<numero<<endl;
- cout<<"Nombre:"<<nombre<<endl;
- }
- int main()
- {
- dvds dvd;
- int num;
- char nom[20];
- cout<<"\n ingresa numero";
- cin>>num;
- cout << (int) nom << endl;
- cout<<"\n ingresa nombre";
- cin>>nom[20]; nom[19]=0;
- dvd.meter(num, nom);
- dvd.mostrar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement