#include <iostream>
#include <string.h>
using namespace std ;
class Etudiant {
private:
char nom[20] ;
char prenom[20];
float *tabnotes ;
public :
Etudiant( const char* nom , const char* prenom );
Etudiant ( );
Etudiant(const Etudiant &e);
void saisie ();
void afficher() ;
float moyenne();
bool admin();
bool ex(Etudiant e) ;
};
Etudiant::Etudiant( const char* nom ,const char* prenom ){
strcpy( this->nom ,nom);
strcpy( this->prenom , prenom );
tabnotes = new float[10];
}
Etudiant::Etudiant( const Etudiant &e){
strcpy ( nom , [Link]);
strcpy( prenom , [Link] ) ;
tabnotes = new float [10];
}
void Etudiant::saisie(){
float note ;
for ( int i =0 ; i< 10 ;i++){
do {
cout << " donner note "<< endl ;
cin >> note;
} while (note <0 || note >20 );
tabnotes[i] = note ;
}
}
void Etudiant::afficher(){
cout << " nom "<< nom<< endl ;
cout << " prenom "<< prenom<< endl ;
for ( int i = 0 ; i< 10 ; i++){
cout << " note "<< i+1 << " : "<< tabnotes[i] << endl ;
}
}
float Etudiant::moyenne () {
int somme = 0 ;
for ( int i = 0 ; i <10 ; i++){
somme += tabnotes[i];
}
return ( somme / 10);
}
bool Etudiant::admin (){
return ( moyenne ()>10);
}
bool Etudiant::ex ( Etudiant e) {
if ( moyenne() == [Link] ()){
return true ;
} else {
return false ;
}
}
class EtudiantMastere: public Etudiant {
private :
float note ;
public :
EtudiantMastere(const char* , const char* ,float );
EtudiantMastere();
void saisie () ;
void afficher() ;
float moyenne() ;
};
EtudiantMastere ::EtudiantMastere( const char * nom , const char * prenom ,
float note) : Etudiant( nom , prenom){
this->note = note ;}
void EtudiantMastere ::saisie () {
Etudiant::saisie();
cout << " donner note "<< endl ;
cin >> note ;
}
void EtudiantMastere ::afficher() {
Etudiant::afficher();
cout << " la note de maitraise d etudiant est "<< endl ;
cout << " note "<< endl ;}
int main(){
Etudiant e1("ahmed","salim");
Etudiant e2("mohad","neji");
[Link]();
[Link]();
[Link]();
[Link]();
if ([Link]()==1 ){
cout<< "admin "<<endl ;}
if ([Link]()==1){
cout<< "admin "<< endl;}
[Link](e2);
EtudiantMastere e3 ( "sam ", "hadid ", 20.0);
[Link]();
[Link]() ;
return 0;
};