forked from IMYod/CPP_league-schedule
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo.cpp
More file actions
74 lines (52 loc) · 1.77 KB
/
Copy pathDemo.cpp
File metadata and controls
74 lines (52 loc) · 1.77 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
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
/**
* A demo program for league.
*
* @author Yoav Gross and Elad Nevi
* @since 2019-06
*/
#include <iostream>
#include "league.hpp"
#include "schedule.hpp"
#include "game.hpp"
#include "Team.hpp"
//for compiling
//Example of printing vector of teams.
//You can write your function instead this
std::ostream& operator<<(std::ostream& out, const std::vector<ariel::Team> & all_elements)
{
out << "[";
for(auto element : all_elements)
{
out << element << ", ";
}
out << "]" << std::endl;
return out;
}
using namespace ariel;
using std::endl, std::cout;
int main() {
league ariel_league(12); //league with 12 teams
ariel_league.create();
ariel_league.play();
cout << "The winner is " << ariel_league.top(1) << endl;
cout << "This groups continued to the final four: " << ariel_league.top(4) << endl;
cout << "This groups have been relegated: " << ariel_league.bottom(2) << endl;
int longest_winnig = ariel_league.longest_winnigs();
cout << "The longest winnig streak was " << longest_winnig << endl;
cout << "The longest loss sequence was " << ariel_league.longest_losses() << endl;
cout << "There are " << ariel_league.count_positive() << " teams with positive total points" << endl;
//Let play the final four!
auto top4 = ariel_league.top(4);
league final4(top4.begin(), top4.end());
final4.create();
final4.play();
cout << "The winner of the final four is: " << final4.top(1) << endl;
//League with some specipic teams
Team t1 = Team(0.85, "Toronto Raptors");
Team t2 = Team(0.9, "Golden State Warriors");
std::vector<Team> some_teams;
some_teams.push_back(t1);
some_teams.push_back(t2);
league NBA(some_teams.begin(), some_teams.end(), 6);
return 0;
}