| 12
 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
 
 | #include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
 
#define LONGNOM 50	//longueur maximum d'un nom ou d'un prénom
 
using namespace std;
 
//**
class Personne{
 
private:	struct personne{
			char nom[LONGNOM];
			char prenom[LONGNOM];
			int age;
			}PERSONNE;
 
struct personne *p;
 
public:	Personne();		//Constructeurs
		Personne(char);
		~Personne();	//Destructeur
 
		void affiche();
		void modif_nom(char *);
		void modif_prenom(char *);
		void modif_age(int);
};
 
//CONSTRUCTEURS
Personne::Personne(){
PERSONNE.nom[1];
PERSONNE.prenom[1];
PERSONNE.age = 0;
}
 
//************
Personne::Personne(char n) {
 
 
}
 
//DESTRUCTEUR
Personne::~Personne(){
delete p;
}
 
//Fonction AFFICHE
void Personne::affiche(){
	cout<<"Nom: "<<PERSONNE.nom<<endl;
	cout<<"Prenom: "<<PERSONNE.prenom<<endl;
	cout<<"Age: "<<PERSONNE.age<<endl;
}
 
//Fonction modif_nom
void Personne::modif_nom(char *n){
cout<<"Modification du nom: "<<endl;
cin>>PERSONNE.nom;	
}
 
//Fonction modif_prenom
void Personne::modif_prenom(char *n){
cout<<"Modification du prenom: "<<endl;
cin>>PERSONNE.prenom;
}
 
//Fonction modif_age
void Personne::modif_age(int a){
cout<<"Modification de l'age: "<<endl;
cin>>PERSONNE.age;
}
 
 
void main(){
 
struct personne MOI;
 
cout<<"Affichage d'une fiche 'personne': "<<endl;
MOI.affiche();
 
getchar();
} | 
Partager