Bonjour a tous , je suis actuellement en train de faire un " projett " pour mes cours
Dans un certains endroit je souhaite ajouter un certains client dans mon magasin ( gestion de billeterie )
Aprés que ce client est etéé rajouter je souhaite trouver ce client avec une fonction du style
quel est l'id du client? rep 3
Afficher client 3
Voila je vous met mes fonctions prncipales
.H
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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 class Client:public Personne { int identifiant; int numtell_; string mail_; public: Client(string n="",string p="",string ad="",int a=0,int nu=0,string ma="",int id=0); void afficher(); ~Client(); }; class Magasin{ string nom_; string adresse_; list <Client> client; list <Fournisseur> fournisseur; list <Personnel> personnel; Facture tabfacture[MAX]; int comptfacture; /*vector<Personne*> a_personnes;*/ public: Magasin(string n="",string ad=""); void afficher(); void AjouterClient(Client Cli); void AjouterPersonnel(Personnel pers); void AjouterFournisseur(Fournisseur four); void Affichertous(); void AjouterFacture(Facture f1); void Afficherfacture(); int getprix(); ~Magasin(); }; Client CréeClient();
.cpp
programme principal
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193 #include "test.h" using namespace std; Client::Client(string n, string p, string ad, int a, int nu, string ma,int id):Personne(n,p,ad,a) { numtell_=nu; mail_=ma; identifiant=id; } void Client::afficher() { cout<<"Client numéroo:"<<identifiant<<endl; cout<<"------------------------------"<<endl; Personne::afficher(); cout <<"Numéroo de Telephone :"<<numtell_<<endl; cout <<"Adresse Email:"<<mail_<<endl; cout<<"\n\n\n\n"; } Client::~Client() { } Magasin::Magasin(string n , string ad ) { nom_=n; adresse_=ad; comptfacture=0; } void Magasin::afficher() { cout<<"Nom :" <<nom_<<endl; cout<<"Adresse : \n\n"<<adresse_<<endl; cout<<endl; } Magasin::~Magasin() { } F void Magasin::AjouterClient(Client Cli) { client.push_back(Cli); } void Magasin::AjouterFournisseur(Fournisseur four) { fournisseur.push_back(four); } void Magasin::AjouterPersonnel(Personnel pers) { personnel.push_back(pers); } void Magasin::Affichertous() { list <Client>::iterator it=client.begin(); Client tmp; cout<<"Liste des clients"<<endl; cout<<"------------------------------------\n"; if(it==client.end()) { } else { while(it!=client.end()) { tmp=*it; tmp.afficher(); cout<<endl; it++; } } list <Fournisseur>::iterator it1=fournisseur.begin(); cout<<"Liste des Fournisseurs"<<endl; cout<<"------------------------------------\n"; Fournisseur tmp1; if(it1==fournisseur.end()) { } else { while(it1!=fournisseur.end()) { tmp1=*it1; tmp1.afficher(); cout<<endl; it1++; } } list <Personnel>::iterator it2=personnel.begin(); cout<<"Liste du personnel"<<endl; cout<<"------------------------------------\n"; Personnel tmp2; if(it2==personnel.end()) { } else { while(it2!=personnel.end()) { tmp2=*it2; tmp2.afficher(); cout<<endl; it2++; } } } Client CréeClient() { int num=0; string mail; int identifiant; string nom; string prenoms; string adresse; int age; cout<<"nom?"<<endl; cin>>nom; cout<<"prenom?"<<endl; cin>>prenoms; cout<<"adresse"<<endl; cin>>adresse; cout<<"age"<<endl; cin>>age; cout<<"nuérooo de telephone"<<endl; cin>>num; cout<<"mail??????"<<endl; cin>>mail; cout<<"identifiant"<<endl; cin>>identifiant; Client cli(nom,prenoms,adresse,age,num,mail,identifiant); return cli; } void Magasin::Afficherfacture() { for(int i = 0; i < comptfacture; i++) tabfacture[i].afficher(); } int Magasin::getprix() { int prixtotal = 0; for(int i = 0; i < comptfacture; i++) prixtotal += tabfacture[i].prix; return prixtotal; } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130 #include "test.h" using namespace std; void main() { int choix=0; Client cli; Fournisseur four; Personnel pers; Artiste a; Facture f; Billet b1(1,"Soadd","2009","Bercyyyyy","rueeeeeee"); b1.afficher(); Magasin m1("Nom agence", "rue 1234"); // Création de Fournisseur , Client et Personnel Fournisseur fo1("nom","prenom","fournisseur",1,1); Client c1("nom","prenom","Client",1,1,"loll"); Personnel p1("nom","prenom","personnel",1,1,"lol"); //Ajout des personnes dans le magasin m1.AjouterFournisseur(fo1); m1.AjouterClient(c1); m1.AjouterPersonnel(p1); //Ajout de Facture Facture f1(1,10,1,"Ironmaiden","23septembre",5); m1.AjouterFacture(f1); do { //Menu de base cout<<"1.Ajouter un Client dans le magasin\n"<<"2.Ajouterrr un fournisseur\n"<<"3.Ajouter du personnel\n"<<"4.Afficher les personnes du magasin\n"<<"5.Voir les recettes Total du magasin\n"<<"6.Voir les Factures\n"<<"7.Ajouterr une facture\n"<<"8.Lire le contenue du fichier Facture.txt\n"<<"9.Crée un fichier Facture.txt\n"<<"10.Quitterr\n"<<endl; cin>>choix; system("cls"); switch(choix) { case 1: //On appel la fonction crée un client et ensuite on ajoute ce client dans le magasin cli=CréeClient(); m1.AjouterClient(cli); system("cls"); break; case 2: four=CréeFournisseur(); m1.AjouterFournisseur(four); system("cls"); break; case 3: pers=CréePersonnel(); m1.AjouterPersonnel(pers); system("cls"); break; case 4: m1.Affichertous(); system("PAUSE"); system("cls"); break; case 5: cout<<"Recette Total de Vente de Billet :"<<m1.getprix()<<" Euros " <<endl; system("PAUSE"); system("cls"); break; case 6: m1.Afficherfacture(); system("pause"); system("cls"); break; case 7: f=Créefacture(); m1.AjouterFacture(f); system("pause"); system("cls"); break; case 8: f1.lire_fichier(); system("pause"); system("cls"); break; case 9: f1.creer_fichier(); system("pause"); system("cls"); case 10: a=créeartiste(); break; default: cout<<"Veuillez recommencez , Choix incorrect\n\n"<<endl; system("pause"); system("cls"); break; } }while(choix!=11); system("PAUSE"); }
Donc a mon avis c'est au niveau des iterateurs mais a part aller au début et a la fin j'ai pas encore appris d'autre choses
merci pour votre aide
Partager