Advertentie | |
|
![]() |
|
![]() |
hier is ie af(nouja mn probleempje gefixed.):
//opdr 6.1 #include<iostream.h> #include<string.h> class persoon { public: persoon(char naamPersoon[30]="...",int pleeftijd=0); //constructor ~persoon(){} //deconstructor void pprint()const; private: char naam[30]; int leeftijd; }; persoon::persoon(char naamPersoon[30],int pleeftijd) //initialisatie { strcpy(naam,naamPersoon); leeftijd=pleeftijd; } void persoon::pprint() const { cout<<naam<<' '<<leeftijd<<endl; } int main() { persoon x[3]; char naam[30]; int leeftijd; for(int i=0;i<3;i++) { cout<<i+1<<" Naam: ";cin>>naam; cout<<" Leeftijd: ";cin>>leeftijd; x[i]=persoon(naam,leeftijd); } for(i=0;i<3;i++) { x[i].pprint(); } return 0; }
__________________
Punk is VERZET
|
Advertentie |
|
![]() |
|
|
![]() |
||||
Forum | Topic | Reacties | Laatste bericht | |
Software & Hardware |
[C++] Abstracte klasses Jordi | 5 | 23-02-2007 12:37 | |
Software & Hardware |
[C++] class/struct type in een var opslaan deathz0rz | 10 | 21-02-2004 03:02 | |
Software & Hardware |
[C++]3 losse modules linken => linking error Dr HenDre | 7 | 30-12-2003 18:54 | |
Software & Hardware |
[C++Buider] Programma werkend krijgen lukt niet. langejongen | 5 | 24-12-2003 19:10 | |
Software & Hardware |
[C++] Class, probleempje(alweer;)) aldi - PUNK | 18 | 24-07-2003 15:33 | |
Software & Hardware |
[C++] Classes variable Talon | 5 | 27-04-2003 19:01 |