Permalink
Browse files

Merge branch 'master' of github.com:mattgu74/LO21

  • Loading branch information...
trecouvr committed Mar 30, 2012
2 parents b3f2ebb + 99a6050 commit 3f909db8b8ca44bd5c76c9b22a2f9874e5fbb1be
Showing with 13 additions and 1 deletion.
  1. +13 −1 TP2/src/banque.cpp
View
@@ -1,5 +1,8 @@
+#include <iostream>
+#include <map>
#include "banque.h"
#include "typecompte.h"
+#include "client.h"
namespace BANQUE {
@@ -14,7 +17,16 @@ namespace BANQUE {
void Banque::AjouterUnClient(std::string nom,std::string prenom,int jourNaissance,int moisNaissance,int anneeNaissance)
{
- // todo
+ Client *monClient = new Client(nom,prenom,jourNaissance,moisNaissance,anneeNaissance);
+ // Search if client exist in map
+ if(this->clients.find((*monClient).GetId()) == this->clients.end())
+ {
+ // Le client n'existe pas
+ this->clients[(*monClient).GetId()] = monClient;
+ } else {
+ delete monClient;
+ std::cerr << "ERROR : Le client " << nom << " " << prenom << " existe déjà !" << std::endl;
+ }
}
void Banque::CreerUnCompte(std::string type, std::string nomClient, std::string prenomClient, int solde)

0 comments on commit 3f909db

Please sign in to comment.