Correction examen c++
Fermé
Majestick
Messages postés
19
Date d'inscription
Statut
Membre
Dernière intervention
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
Je vous contacte car j'ai un examen en C++ (à l'écrit) vendredi. J'ai une annale à laquelle j'ai répondu et je souhaiterais savoir si vous pourriez jeter un coup d'oeil aux réponses que j'ai apporté.
Je vous joins l'annale et mes réponses:


Et voici mon code:
Client.h
Client.cpp
Employe.h
Employe.cpp
Commercial.h
Commercial.cpp
AgenceLocale.h
AgenceLocale.cpp
J'espère que vous pourrez m'indiquer où je me suis trompé et pourquoi.
Je vous remercie de votre aide!
Je vous contacte car j'ai un examen en C++ (à l'écrit) vendredi. J'ai une annale à laquelle j'ai répondu et je souhaiterais savoir si vous pourriez jeter un coup d'oeil aux réponses que j'ai apporté.
Je vous joins l'annale et mes réponses:


Et voici mon code:
Client.h
#ifndef __annale2014__client__ #define __annale2014__client__ //#include "agenceLocale.h" #include <iostream> #include <string> using namespace std; class Client { string nom; string adresse; AgenceLocale& agenceLocale; public: Client(string n="", string a="", AgenceLocale& al); AgenceLocale operator(); void afficher(); }; #endif /* defined(__annale2014__client__) */
Client.cpp
#include "client.h" Client(string n,string a, AgenceLocale& al):this->nom(n), this->adresse(a), this->agenceLocale(al){} AgenceLocale operator() {return this->agenceLocale->nom;} void afficher() {cout << this->nom << this->adresse << this->*agenceLocale;}
Employe.h
#ifndef __annale2014__employe__ #define __annale2014__employe__ #include "agenceLocale.h" #include <iostream> #include <string> using namespace std; class Employe { string nom; int id; AgenceLocale *agl; public: Employe(string n="", int i = 0); virtual void afficher(); virtual float calculerSalaire() = 0; }; #endif /* defined(__annale2014__employe__) */
Employe.cpp
#include "employe.h" Employe(string n, int i):this->nom(n), this->id(i) {} virtual void afficher() {cout << this->nom << this->id << this->*agl;} virtual float calculerSalaire() = 0;
Commercial.h
#ifndef __annale2014__commercial__ #define __annale2014__commercial__ #include <iostream> #include <string> using namespace std; class Commercial:public Employe { float pourcentage; float fixe; public: Commercial(string n="", int i =0, float p=0.0, float f=0.0); public float calculerSalaire(); } #endif /* defined(__annale2014__commercial__) */
Commercial.cpp
#include "commercial.h" Commercial(string n, int i =0, float p=0.0, float f=0.0):Employer(n,i), pourcentage(p), fixe(f) {} float calculerSalaire(){}
AgenceLocale.h
#ifndef __annale2014__agenceLocale__ #define __annale2014__agenceLocale__ #include "region.h" #include "employe.h" #include "client.h" #include "vente.h" #include <iostream> #include <string> #include <list> using namespace std; class AgenceLocale { string nom; Region& nomR; int nbEmp; Employe employe[nbEmp]; list<Client> c; list<Vente> v; public: AgenceLocale(string n="", Region& r, int nb = 0); AgenceLocale(const AgenceLocale& copie); void addEmploye(string nom, int id); Vente AgenceLocale::operator[](int i); ostream& operator<<(ostream& out, Client& c); float calculerSalaire(); float salaireCommerciaux(); }; #endif /* defined(__annale2014__agenceLocale__) */
AgenceLocale.cpp
#include "agenceLocale.h" AgenceLocale(string n, Region& r, int nb):this->nom(n), this->nomR(r), this->nbEmp(nb) { employe = new Employe[nb]; c = *new list<Client>(); v = *new list<Vente>(); } AgenceLocale(const AgenceLocale& copie) { this->nom = copie.nom; this->nomR = copie.nomR; this->nbEmp = copie.nbEmp; this->employe = copie.employe; this->employe = new Employe[copie.nbEmp]; for(int i = 0; i < nbEmp; i++) { this->employe[i] = copie.employe[i]; } c = copie.c; v = copie.v; } void addEmploye(string nom, int id) { Employe * e = new Employe(nom, id); this->employe[nbEmp] = *e; this->nbEmp++; } Vente AgenceLocale::operator[](int i) const { return v[i]; } ostream& operator<<(ostream& out, Client& c) { for(list<Clien*> ::iterator it=lclient.begin(); it != lclient.endl();++it) { out << it->c.nom << endl; } } float calculerSalaire() { list<Employe> lemploye; float somme = 0.0; for(list<Employe*>::iterator it = lemploye.begin(); it != lemploye.end();++it) { somme += it->calculerSalaire(); } return somme; } float salaireCommerciaux() { list<Commercial> lcommercial; float somme = 0.0; for(list<Commercial*>::iterator it = lcommercial.begin(); it != lcommercial.end();++it) { somme += it->calculerSalaire(); } return somme; }
J'espère que vous pourrez m'indiquer où je me suis trompé et pourquoi.
Je vous remercie de votre aide!
A voir également:
- Correction examen c++
- Activer correction automatique android - Guide
- Telecharger clavier français avec correction - Télécharger - Divers Utilitaires
- Le correcteur automatique de votre smartphone vous rend fou ? Voici comment le désactiver - Accueil - Mobile
- Mode correction word - Guide
- Sujet examen tai - Forum Études / Formation High-Tech
1 réponse
Sujet en cours sur CodeS SourceS
merci de continuer là
https://codes-sources.commentcamarche.net/forum/affich-10044777-correction-examen-c-aide#p10044777
merci de continuer là
https://codes-sources.commentcamarche.net/forum/affich-10044777-correction-examen-c-aide#p10044777