-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·46 lines (35 loc) · 1.26 KB
/
main.cpp
File metadata and controls
executable file
·46 lines (35 loc) · 1.26 KB
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
#include <iostream>
#include "personnage.h" //Ne pas oublier
#include "arme.h"
#include "duree.h"
using namespace std;
int main()
{
Personnage david, goliath("Epée aiguisée",20);
Personnage allan("Epée aiguisée",20);
Personnage ymap(allan); // Création de yamp en copiant les attributs de Allan
//Création de 2 objets de type Personnage :allan et ymap
david.boirePotionDeVie(20); //david récupère 20 de vie en buvant une potion
goliath.attaquer(david); //goliath attaque david
david.attaquer(goliath); //david contre-attaque... c'est assez clair non ?
goliath.changerArme("Double hache tranchante veneneuse de la mort", 40);
goliath.attaquer(david);
//Temps mort ! Voyons voir la vie de chacun…
cout << "David" << endl;
david.afficherEtat();
cout << endl << "Goliath" << endl;
goliath.afficherEtat();
Duree duree1(0, 40, 28), duree2(0, 55, 45);
cout <<"Duree 1 : ";
duree1.afficher();
cout <<"Duree 2 : ";
duree2.afficher();
cout <<"Somme des deux durees : ";
Duree somme = duree1 + duree2;
somme.afficher();
if (duree1 == duree2)
cout << "Les deux durees sont egales." << endl;
else
cout << "Les deux durees sont differentes." << endl;
return 0;
}