⚲
Projet
Général
Profil
Connexion
S'enregistrer
Accueil
Projets
Aide
Recherche
:
2021_tournoi_pingpong
Tous les projets
2021_tournoi_pingpong
Aperçu
Activité
Demandes
Gantt
Annonces
Documents
Wiki
Fichiers
Dépôt
Télécharger (1,68 ko)
Publication de fichiers
» match.cpp
Anonyme, 11/01/2022 10:42
#include
"match.hpp"
#include
<sstream>
#include
<fstream>
using
namespace
std
;
//constructeur
Match
::
Match
(
int
numMatch
,
Joueur
jA
,
Joueur
jB
,
int
scoreA
,
int
scoreB
,
bool
joue
){
this
->
numMatch
=
numMatch
;
this
->
joueurA
=
jA
;
this
->
joueurB
=
jB
;
this
->
scoreA
=
scoreA
;
this
->
scoreB
=
scoreB
;
this
->
joue
=
joue
;
}
Joueur
Match
::
getJoueurA
()
const
{
return
joueurA
;
}
int
Match
::
getNumMatch
(){
return
numMatch
;
}
void
Match
::
setNumMatch
(
int
s
){
numMatch
=
s
;
}
Joueur
Match
::
getJoueurB
()
const
{
return
joueurB
;
}
void
Match
::
setJoueurA
(
Joueur
j
){
joueurA
=
j
;
}
void
Match
::
setJoueurB
(
Joueur
j
){
joueurB
=
j
;
}
int
Match
::
getScoreA
(){
return
scoreA
;
}
int
Match
::
getScoreB
(){
return
scoreB
;
}
void
Match
::
setScoreA
(
int
s
){
scoreA
=
s
;
}
void
Match
::
setScoreB
(
int
s
){
scoreB
=
s
;
}
void
Match
::
setEcart
(
int
a
,
int
b
){
if
(
a
<
b
){
joueurB
.
setEcart
(
b
-
a
);
joueurA
.
setEcart
(
a
-
b
);
joueurA
.
setPoint
(
2
);
}
if
(
a
>
b
){
joueurA
.
setEcart
(
a
-
b
);
joueurB
.
setEcart
(
b
-
a
);
joueurB
.
setPoint
(
2
);
}
if
(
a
==
b
){
joueurA
.
setPoint
(
1
);
joueurB
.
setPoint
(
1
);
}
}
bool
Match
::
getJoue
(){
return
joue
;
}
void
Match
::
setJoue
(
int
s
){
if
(
s
==
0
){
joue
=
false
;
}
else
{
joue
=
true
;
}
}
string
Match
::
afficher
()
const
{
ostringstream
ss
;
ss
<<
"num Match : "
<<
numMatch
<<
endl
;
ss
<<
" Joueur A : "
<<
joueurA
.
afficher
()
<<
endl
;
ss
<<
"score : "
<<
scoreA
<<
endl
;
ss
<<
"Joueur B : "
<<
joueurB
.
afficher
()
<<
endl
;
ss
<<
"score : "
<<
scoreB
<<
endl
;
return
ss
.
str
();
}
« Précédent
1
2
3
4
5
6
7
Suivant »
(4-4/7)
Chargement...