-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjourneys.cpp
53 lines (42 loc) · 1.86 KB
/
journeys.cpp
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
/*************************************************************************
journeys
-------------------
début : 27/11/2023
copyright : (C) 2023 par Jixiang, Adam, Clément, Louis
binome : B3311 et B3309
*************************************************************************/
//---------- Réalisation de la classe <journeys> (fichier journeys.cpp) ----------
//---------------------------------------------------------------- INCLUDE
//-------------------------------------------------------- Include système
#include <iostream>
using std::cout;
using std::ostream;
//------------------------------------------------------ Include personnel
#include "journeys.h"
//----------------------------------------------------------------- PUBLIC
//------------------------------------------------- Surcharge d'opérateurs
ostream &operator<<(ostream &os, const Journeys &journeys) {
journeys.show();
return os;
} //----- Fin de operator <<
//------------------------------------------------------------------ PRIVE
//----------------------------------------------------- Méthodes privées
void Journeys::show(const char sep) const
// Algorithme :
// Show all the journeys in the journeys
// sep : the separator between each journey
// If sep is '\n', the function will print the index of the journey
// before printing the journey
// If sep is not '\n', the function will not print the index of the journey
// before printing the journey
{
Node<Journey> *nodeJourney = journeyLinkedList.GetFirst();
for (unsigned int i = 1; nodeJourney; i++) {
if (sep == '\n')
cout << i << ". ";
cout << *nodeJourney->pdata;
nodeJourney = nodeJourney->next;
if (nodeJourney)
cout << sep;
}
} //----- Fin de show