Search
Napište program, který spočítá statistiky jednoho dne provozu zjednodušeného systému hromadné dopravy. V závislosti na argumentech zadaných při spuštění programu vypište do std::cout následující:
std::cout
Detailně jsou jednotlivé výpisy a statistiky popsány v následujících sekcích. K dispozici máte soubory které obsahují hotové části kódu:
main.cpp
doprava.hpp
doprava.cpp
Soubory jsou uložené v balíčku HW04.zip. Všechny tři soubory můžete upravit, všechny tři se odevzdávají do BRUTE.
Seznam všech řidičů imaginárního dopravního podniku je uložena v instanci DriverList dl. S DriverList lze pracovat stejně jako s std::list<Driver>, navíc je pouze funkce na načítání ze souboru.
DriverList dl
DriverList
std::list<Driver>
Všechny linky jsou uoženy v instanci Network net. K přístupu k dané lince vhodné využít zavolání funkce Line linka = net.getLine(cislo_linky); nebo jejího ekvivalentu Line linka = net(cislo_linky);. Počet linek zjistíte funkcí Network::nlines();. Linky jsou indexovány od 0.
Network net
Line linka = net.getLine(cislo_linky);
Line linka = net(cislo_linky);
Network::nlines();
0
Každá linka v Network net je typu Line. Třída Line obsahuje 3 vektory s viditelností public:
Line
public
vector<string> stops
vector<PlanConn> conns_fwd
vector<PlanConn> conns_bwd
Každý spoj je vektorem odjezdů (instancí třídy Departure). Délka i indexování stops, conns_fwd, conns_bwd jsou stejné.
Departure
stops
conns_fwd
conns_bwd
Odjezdy ze zastávek jsou uloženy v instanci DepartDB ddb. K přístupu můžete využít dvě možnosti:
DepartDB ddb
multimap<string, StDepart> db;
string
StDepart
vector<StDepart> getStDeparts(const string & stop) const;
const
Pro přístup do standardních šabon zkuste využít konstantní iterátory. Například místo x.begin() můžete použít x.cbegin()
x.begin()
x.cbegin()
Popis není úplný, další informace můžou poskytnout komentáře v doprava.hpp nebo implementace v doprava.cpp.
Lndir
enum class
Lndir::fwd
Lndir::bwd
Time
int gets()
void gett(hh,mm,ss)
int
Depart
Time ti
Lndir dir
int ln
int conn
Driver
string name
PlanConn
vector<Depart>
Driver drv
./main --schedule [Nazev_zastavky1] [Nazev_zastavky2] [Nazev_zastavky3] ...
./main --schedule "Petrackovo_namesti" "Vitkov" "U_Bufetu"
Implementujte výpis zastávkových jízdních řádů ve formátu:
+------------------------------------------------------------------------------+ | [Jmeno zastavky pro kterou je jizdni rad] Line: L | +--------------------------------------++--------------------------------------+ | To: [Posledni zastavka linky] || To: [Prvni zastavka linky] | +----+---------------------------------++----+---------------------------------+ | 00 | << minuty odjezdu >> || 00 | | | 01 | 20 40 || 01 | 00 30 | <<< Zde jsou radky pro vsechny hodniny >>> | 23 | || 23 | | +----+---------------------------------++----+---------------------------------+
Time::gett(hh, mm, ss)
DepartDB
Ukázka výstupu pro výše zmíněný příklad volání je v poskytnutém souboru output1.txt nebo zde:
output1.txt
Loaded 45 names from driver_list.txt. Loaded network from network.txt. Loaded departure database from departures.txt. +------------------------------------------------------------------------------+ | Petrackovo namesti Line: 1 | +--------------------------------------++--------------------------------------+ | To: Spanelska || To: Italska | +----+---------------------------------++----+---------------------------------+ | 00 | || 00 | | | 01 | || 01 | | | 02 | || 02 | | | 03 | || 03 | | | 04 | 13 38 || 04 | 22 47 | | 05 | 03 28 53 || 05 | 12 37 | | 06 | 18 38 58 || 06 | 02 27 47 | | 07 | 18 38 58 || 07 | 07 27 47 | | 08 | 18 38 58 || 08 | 07 27 47 | | 09 | 18 38 58 || 09 | 07 27 47 | | 10 | 18 38 58 || 10 | 07 27 47 | | 11 | 23 48 || 11 | 07 32 57 | | 12 | 13 38 || 12 | 22 47 | | 13 | 03 28 53 || 13 | 12 37 | | 14 | 18 43 || 14 | 02 27 52 | | 15 | 08 28 48 || 15 | 17 37 57 | | 16 | 08 28 48 || 16 | 17 37 57 | | 17 | 08 28 48 || 17 | 17 37 57 | | 18 | 08 28 48 || 18 | 17 37 57 | | 19 | 08 28 48 || 19 | 17 37 57 | | 20 | 28 || 20 | 37 | | 21 | 08 48 || 21 | 17 57 | | 22 | 28 || 22 | 37 | | 23 | || 23 | | +----+---------------------------------++----+---------------------------------+ +------------------------------------------------------------------------------+ | Petrackovo namesti Line: 2 | +--------------------------------------++--------------------------------------+ | To: Maternovy sady || To: Vitkov | +----+---------------------------------++----+---------------------------------+ | 00 | || 00 | | | 01 | || 01 | | | 02 | || 02 | | | 03 | || 03 | | | 04 | 58 || 04 | | | 05 | 38 || 05 | 04 44 | | 06 | 18 38 58 || 06 | 24 44 | | 07 | 18 38 58 || 07 | 04 24 44 | | 08 | 18 38 58 || 08 | 04 24 44 | | 09 | 18 38 58 || 09 | 04 24 44 | | 10 | 38 || 10 | 04 44 | | 11 | 18 58 || 11 | 24 | | 12 | 38 || 12 | 04 44 | | 13 | 18 58 || 13 | 24 | | 14 | 38 || 14 | 04 44 | | 15 | 18 58 || 15 | 24 | | 16 | 18 38 58 || 16 | 04 24 44 | | 17 | 18 38 58 || 17 | 04 24 44 | | 18 | 18 38 58 || 18 | 04 24 44 | | 19 | 18 38 58 || 19 | 04 24 44 | | 20 | 18 38 58 || 20 | 04 24 44 | | 21 | 38 || 21 | 04 44 | | 22 | 18 58 || 22 | 24 | | 23 | || 23 | 04 | +----+---------------------------------++----+---------------------------------+ +------------------------------------------------------------------------------+ | Vitkov Line: 2 | +--------------------------------------++--------------------------------------+ | To: Maternovy sady || To: Vitkov | +----+---------------------------------++----+---------------------------------+ | 00 | || 00 | | | 01 | || 01 | | | 02 | || 02 | | | 03 | || 03 | | | 04 | 45 || 04 | | | 05 | 25 || 05 | 18 58 | | 06 | 05 25 45 || 06 | 38 58 | | 07 | 05 25 45 || 07 | 18 38 58 | | 08 | 05 25 45 || 08 | 18 38 58 | | 09 | 05 25 45 || 09 | 18 38 58 | | 10 | 25 || 10 | 18 58 | | 11 | 05 45 || 11 | 38 | | 12 | 25 || 12 | 18 58 | | 13 | 05 45 || 13 | 38 | | 14 | 25 || 14 | 18 58 | | 15 | 05 45 || 15 | 38 | | 16 | 05 25 45 || 16 | 18 38 58 | | 17 | 05 25 45 || 17 | 18 38 58 | | 18 | 05 25 45 || 18 | 18 38 58 | | 19 | 05 25 45 || 19 | 18 38 58 | | 20 | 05 25 45 || 20 | 18 38 58 | | 21 | 25 || 21 | 18 58 | | 22 | 05 45 || 22 | 38 | | 23 | || 23 | 18 | +----+---------------------------------++----+---------------------------------+ +------------------------------------------------------------------------------+ | U Bufetu Line: 0 | +--------------------------------------++--------------------------------------+ | To: Studijni odd. || To: U Petnika | +----+---------------------------------++----+---------------------------------+ | 00 | || 00 | | | 01 | || 01 | | | 02 | || 02 | | | 03 | || 03 | | | 04 | 20 50 || 04 | 13 43 | | 05 | 20 50 || 05 | 13 43 | | 06 | 20 35 50 || 06 | 13 28 43 58 | | 07 | 05 20 35 50 || 07 | 13 28 43 58 | | 08 | 05 20 35 50 || 08 | 13 28 43 58 | | 09 | 05 20 35 50 || 09 | 13 28 43 58 | | 10 | 05 20 50 || 10 | 13 43 | | 11 | 20 50 || 11 | 13 43 | | 12 | 20 50 || 12 | 13 43 | | 13 | 20 50 || 13 | 13 43 | | 14 | 20 50 || 14 | 13 43 | | 15 | 20 35 50 || 15 | 13 28 43 58 | | 16 | 05 20 35 50 || 16 | 13 28 43 58 | | 17 | 05 20 35 50 || 17 | 13 28 43 58 | | 18 | 05 20 35 50 || 18 | 13 28 43 58 | | 19 | 05 20 50 || 19 | 13 43 | | 20 | 20 50 || 20 | 13 43 | | 21 | 20 50 || 21 | 13 43 | | 22 | 20 50 || 22 | 13 43 | | 23 | 20 || 23 | 13 | +----+---------------------------------++----+---------------------------------+
./main --line-routing
Implementujte výpis vedení (seznamu zastávek) pro všechny linky ve formátu:
+------------------------------------------------------------------------------+ | Line: L | +---+----+-----------------------------++---+----+-----------------------------+ | d | rT | ==> || d | rT | <== | +---+----+-----------------------------++---+----+-----------------------------+ | 0 | 00 | Zastavka(0) || 0 | 00 | Zastavka(N-1) | | # | ## | Zastavka(1) || # | ## | Zastavka(N) | <<< Zde jsou radky pro vsechny zastavky>>> | # | ## | Zastavka(N-1) || # | ## | Zastavka(1) | | # | ## | Zastavka(N) || # | ## | Zastavka(0) | +---+----+-----------------------------++---+----+-----------------------------+
Ukázka výstupu pro výše zmíněný příklad volání je v poskytnutém souboru output2.txt nebo zde:
output2.txt
Loaded 45 names from driver_list.txt. Loaded network from network.txt. Loaded departure database from departures.txt. +------------------------------------------------------------------------------+ | Line: 0 | +---+----+-----------------------------++---+----+-----------------------------+ | d | rT | ==> || d | rT | <== | +---+----+-----------------------------++---+----+-----------------------------+ | 0 | 00 | U Petnika || 0 | 00 | Studijni odd. | | 3 | 03 | Pred Menzou || 2 | 02 | Rektorat | | 2 | 05 | Matematiku || 1 | 03 | Dekanat | | 2 | 07 | Fyziku || 2 | 06 | Knihovnicka | | 2 | 09 | Radioelektronicka || 2 | 08 | U Bufetu | | 1 | 10 | Elektromagnetickeho pole || 2 | 10 | U Zavrene skoly | | 2 | 12 | Mikroelektronicka || 1 | 11 | Nosterova | | 1 | 14 | Studentska || 1 | 13 | Paterova | | 1 | 15 | Paterova || 1 | 14 | Studentska | | 1 | 16 | Nosterova || 1 | 16 | Mikroelektronicka | | 1 | 18 | U Zavrene skoly || 2 | 18 | Elektromagnetickeho pole | | 2 | 20 | U Bufetu || 1 | 19 | Radioelektronicka | | 2 | 22 | Knihovnicka || 2 | 21 | Fyziku | | 2 | 24 | Dekanat || 2 | 23 | Matematiku | | 1 | 26 | Rektorat || 2 | 25 | Pred Menzou | | 2 | 28 | Studijni odd. || 3 | 28 | U Petnika | +---+----+-----------------------------++---+----+-----------------------------+ +------------------------------------------------------------------------------+ | Line: 1 | +---+----+-----------------------------++---+----+-----------------------------+ | d | rT | ==> || d | rT | <== | +---+----+-----------------------------++---+----+-----------------------------+ | 0 | 00 | Italska || 0 | 00 | Spanelska | | 3 | 03 | Desinfekcni || 2 | 02 | V Karantene | | 3 | 06 | Lihovar || 2 | 04 | Na Ventilaci | | 3 | 09 | Za Filtrem || 2 | 06 | Infekcni | | 3 | 12 | Testovaci || 2 | 08 | Svepomoci | | 2 | 14 | Respiratoru || 2 | 10 | Remdesivirova | | 2 | 16 | Petrackovo namesti || 2 | 12 | Prymulova | | 2 | 18 | Ochrannych stitu || 2 | 14 | U Zavrene skoly | | 2 | 20 | U Zavrene skoly || 2 | 16 | Ochrannych stitu | | 2 | 22 | Prymulova || 2 | 18 | Petrackovo namesti | | 2 | 24 | Remdesivirova || 2 | 20 | Respiratoru | | 2 | 26 | Svepomoci || 2 | 22 | Testovaci | | 2 | 28 | Infekcni || 3 | 25 | Za Filtrem | | 2 | 30 | Na Ventilaci || 3 | 28 | Lihovar | | 2 | 32 | V Karantene || 3 | 31 | Desinfekcni | | 2 | 34 | Spanelska || 3 | 34 | Italska | +---+----+-----------------------------++---+----+-----------------------------+ +------------------------------------------------------------------------------+ | Line: 2 | +---+----+-----------------------------++---+----+-----------------------------+ | d | rT | ==> || d | rT | <== | +---+----+-----------------------------++---+----+-----------------------------+ | 0 | 00 | Vitkov || 0 | 00 | Maternovy sady | | 2 | 02 | Dobesova alej || 2 | 02 | Pani Vyborne | | 2 | 04 | Navratilova || 2 | 04 | Petrackovo namesti | | 2 | 06 | Nentvichova || 2 | 06 | Patova trida | | 2 | 09 | Studentska || 2 | 09 | Studentska | | 2 | 11 | Patova trida || 2 | 11 | Nentvichova | | 2 | 13 | Petrackovo namesti || 2 | 13 | Navratilova | | 2 | 15 | Pani Vyborne || 2 | 15 | Dobesova alej | | 2 | 18 | Maternovy sady || 2 | 18 | Vitkov | +---+----+-----------------------------++---+----+-----------------------------+ +------------------------------------------------------------------------------+ | Line: 3 | +---+----+-----------------------------++---+----+-----------------------------+ | d | rT | ==> || d | rT | <== | +---+----+-----------------------------++---+----+-----------------------------+ | 0 | 00 | Svepomoci || 0 | 00 | Posledni role | | 2 | 02 | Dobrovolniku || 2 | 02 | Papirenske zavody | | 2 | 04 | Lekaru || 2 | 04 | Bezrouskova | | 2 | 06 | Svadlen || 2 | 06 | Cesko-cinskeho pratelstvi | | 2 | 09 | Cesko-cinskeho pratelstvi || 2 | 09 | Svadlen | | 2 | 11 | Bezrouskova || 2 | 11 | Lekaru | | 2 | 13 | Papirenske zavody || 2 | 13 | Dobrovolniku | | 2 | 15 | Posledni role || 2 | 15 | Svepomoci | +---+----+-----------------------------++---+----+-----------------------------+
./main --driver-delays
Implementujte výpis seznamu řidičů se statistikam zpoždění ve formátu:
+----------------------+---+-----+----+-------+-------+-------+-------+------+------+------+ | Driver Name | L | nSt | nE | E-max | D-avg | D-min | D-max | D<1m | D<2m | D<5m | +----------------------+---+-----+----+-------+-------+-------+-------+------+------+------+ | Nejrychlejsi ridic | # | ## | ## | mm:ss | mm:ss | mm:ss | mm:ss | ###% | ###% | ###% | <<< Zde jsou radky pro vsechny ridice>>> | Nevyuzity Ridic | X | XXX | XX | XX:XX | XX:XX | XX:XX | XX:XX | XXX% | XXX% | XXX% | +----------------------+---+-----+----+-------+-------+-------+-------+------+------+------+
mm:ss
X
Obsah sloupců je:
Driver Name
L
nSt
nE
E-max
D-avg
D-min
D-max
D<1m
D<2m
D<5m
Seznam seřaďte podle následujících kritérií:
tj. pokud se shoduje kritérium 1, řadíte podle kritéria 2 atd.
double
foat
Ukázka výstupu pro výše zmíněné volání je v poskytnutém souboru output3.txt nebo zde:
output3.txt
Loaded 45 names from driver_list.txt. Loaded network from network.txt. Loaded departure database from departures.txt. +----------------------+---+-----+----+-------+-------+-------+-------+------+------+------+ | Driver Name | L | nSt | nE | E-max | D-avg | D-min | D-max | D<1m | D<2m | D<5m | +----------------------+---+-----+----+-------+-------+-------+-------+------+------+------+ | Petter Solberg | 3 | 56 | 1 | 00:31 | 00:01 | 00:00 | 00:21 | 100% | 100% | 100% | | Alberto Ascari | 2 | 108 | 1 | 00:15 | 00:02 | 00:00 | 00:35 | 100% | 100% | 100% | | Emerson Fittipaldi | 0 | 144 | 2 | 01:12 | 00:07 | 00:00 | 01:59 | 96% | 100% | 100% | | Henri Toivonen | 3 | 80 | 0 | 00:00 | 00:14 | 00:00 | 00:53 | 100% | 100% | 100% | | Stig Blomqvist | 3 | 72 | 1 | 00:01 | 00:33 | 00:00 | 01:35 | 75% | 100% | 100% | | Niki Lauda | 0 | 160 | 0 | 00:00 | 00:36 | 00:00 | 05:15 | 78% | 86% | 99% | | Giuseppe Farina | 2 | 81 | 0 | 00:00 | 00:47 | 00:00 | 02:28 | 66% | 97% | 100% | | Ayrton Senna | 0 | 160 | 2 | 00:08 | 00:49 | 00:00 | 07:07 | 75% | 82% | 96% | | Michele Mouton | 3 | 64 | 0 | 00:00 | 00:50 | 00:00 | 02:29 | 54% | 96% | 100% | | Nelson Piquet | 0 | 176 | 1 | 00:34 | 00:52 | 00:00 | 04:30 | 73% | 80% | 100% | | Phil Hill | 2 | 90 | 0 | 00:00 | 00:57 | 00:00 | 03:06 | 58% | 90% | 100% | | Jenson Button | 1 | 112 | 0 | 00:00 | 01:01 | 00:00 | 06:05 | 69% | 82% | 97% | | John Surtees | 0 | 128 | 0 | 00:00 | 01:01 | 00:00 | 05:51 | 63% | 80% | 95% | | Juan M. Fangio | 2 | 72 | 0 | 00:00 | 01:01 | 00:00 | 02:56 | 52% | 86% | 100% | | Richard Burns | 3 | 64 | 0 | 00:00 | 01:01 | 00:00 | 03:24 | 53% | 85% | 100% | | Jim Clark | 0 | 144 | 0 | 00:00 | 01:02 | 00:00 | 07:45 | 68% | 77% | 96% | | James Hunt | 0 | 128 | 0 | 00:00 | 01:05 | 00:00 | 04:54 | 66% | 79% | 100% | | Carlos Sainz | 3 | 72 | 0 | 00:00 | 01:09 | 00:00 | 02:46 | 43% | 81% | 100% | | Alan Jones | 2 | 81 | 0 | 00:00 | 01:10 | 00:00 | 03:12 | 48% | 80% | 100% | | Michael Schumacher | 1 | 128 | 7 | 00:19 | 01:10 | 00:00 | 05:13 | 53% | 78% | 99% | | Miki Biasion | 3 | 72 | 0 | 00:00 | 01:15 | 00:00 | 03:18 | 44% | 77% | 100% | | Jackie Stewart | 0 | 160 | 0 | 00:00 | 01:16 | 00:00 | 06:44 | 60% | 74% | 95% | | Kimi Raikkonen | 1 | 128 | 0 | 00:00 | 01:17 | 00:00 | 05:27 | 53% | 73% | 96% | | Denny Hulme | 2 | 81 | 0 | 00:00 | 01:21 | 00:00 | 03:35 | 41% | 74% | 100% | | Jody Scheckter | 2 | 72 | 1 | 00:07 | 01:35 | 00:00 | 04:17 | 33% | 61% | 100% | | Timo Salonen | 3 | 80 | 0 | 00:00 | 01:47 | 00:00 | 04:36 | 31% | 56% | 100% | | Jochen Rindt | 0 | 128 | 1 | 00:08 | 01:49 | 00:00 | 07:09 | 40% | 61% | 93% | | Mario Andretti | 2 | 72 | 1 | 00:08 | 01:54 | 00:00 | 04:55 | 29% | 54% | 100% | | Ari Vatanen | 3 | 64 | 0 | 00:00 | 01:59 | 00:00 | 05:15 | 31% | 53% | 98% | | Mike Hawthorn | 2 | 81 | 0 | 00:00 | 01:59 | 00:00 | 04:25 | 25% | 51% | 100% | | Mika Hakkinen | 1 | 112 | 0 | 00:00 | 02:02 | 00:00 | 08:01 | 40% | 71% | 84% | | Nico Rosberg | 1 | 128 | 0 | 00:00 | 02:07 | 00:00 | 09:10 | 35% | 60% | 92% | | Jack Brabham | 0 | 128 | 2 | 00:39 | 02:15 | 00:00 | 08:28 | 36% | 57% | 88% | | Nigel Mansell | 1 | 128 | 0 | 00:00 | 02:32 | 00:00 | 11:35 | 38% | 52% | 83% | | Jacques Villeneuve | 1 | 144 | 0 | 00:00 | 02:38 | 00:00 | 10:31 | 35% | 54% | 82% | | Lewis Hamilton | 1 | 128 | 0 | 00:00 | 02:39 | 00:00 | 17:37 | 46% | 69% | 83% | | Fernando Alonso | 1 | 144 | 0 | 00:00 | 03:03 | 00:00 | 13:53 | 27% | 47% | 81% | | Sebastian Vettel | 1 | 144 | 0 | 00:00 | 03:40 | 00:00 | 16:32 | 21% | 38% | 77% | | Graham Hill | 0 | 160 | 0 | 00:00 | 03:42 | 00:00 | 14:59 | 24% | 36% | 71% | | Keke Rosberg | 0 | 144 | 0 | 00:00 | 05:05 | 00:00 | 15:26 | 12% | 22% | 51% | | Alain Prost | 1 | 128 | 0 | 00:00 | 05:07 | 00:00 | 12:37 | 13% | 23% | 49% | | Damon Hill | 1 | 112 | 0 | 00:00 | 07:18 | 00:00 | 18:42 | 9% | 18% | 39% | | Bruce McLaren | X | XXX | XX | XX:XX | XX:XX | XX:XX | XX:XX | XXX% | XXX% | XXX% | | Eddie Irvine | X | XXX | XX | XX:XX | XX:XX | XX:XX | XX:XX | XXX% | XXX% | XXX% | | Jean Alesi | X | XXX | XX | XX:XX | XX:XX | XX:XX | XX:XX | XXX% | XXX% | XXX% | +----------------------+---+-----+----+-------+-------+-------+-------+------+------+------+
./main --driver-duty
Implementujte výpis seznamu řidičů se statistikam provedených jízd ve formátu:
+----------------------+---+----+-----+-------+-------+----------+-------+-------+----------+----------+-----+ | Driver Name | L | nC | nSt | P-avg | P-max | P-tot | R-avg | R-max | R-Tot | R-P | +% | +----------------------+---+----+-----+-------+-------+----------+-------+-------+----------+----------+-----+ | Nejvytizenejsi ridic | # | ## | ### | mm:ss | mm:ss | hh:mm:ss | mm:ss | mm:ss | hh:mm:ss | hh:mm:ss | ##% | <<< Zde jsou radky pro vsechny ridice>>> | Nevyuzity Ridic | X | XX | XXX | XX:XX | XX:XX | XX:XX:XX | XX:XX | XX:XX | XX:XX:XX | XX:XX:XX | XX% | +----------------------+---+----+-----+-------+-------+----------+-------+-------+----------+----------+-----+
hh:mm:ss
nC
P-avg
P-max
P-tot
R-avg
R-max
R-tot
R-P
+%
Ukázka výstupu pro výše zmíněné volání je v poskytnutém souboru output4.txt nebo zde:
output4.txt
Loaded 45 names from driver_list.txt. Loaded network from network.txt. Loaded departure database from departures.txt. +----------------------+---+----+-----+-------+-------+----------+-------+-------+----------+----------+-----+ | Driver Name | L | nC | nSt | P-avg | P-max | P-tot | R-avg | R-max | R-Tot | R-P | +% | +----------------------+---+----+-----+-------+-------+----------+-------+-------+----------+----------+-----+ | Sebastian Vettel | 1 | 9 | 144 | 34:50 | 34:50 | 05:13:30 | 41:12 | 51:22 | 06:10:52 | 00:57:22 | 18% | | Graham Hill | 0 | 10 | 160 | 28:40 | 28:40 | 04:46:40 | 36:18 | 43:39 | 06:03:04 | 01:16:24 | 26% | | Fernando Alonso | 1 | 9 | 144 | 34:50 | 34:50 | 05:13:30 | 40:15 | 48:43 | 06:02:18 | 00:48:48 | 15% | | Jacques Villeneuve | 1 | 9 | 144 | 34:50 | 34:50 | 05:13:30 | 39:19 | 43:43 | 05:53:58 | 00:40:28 | 12% | | Alain Prost | 1 | 8 | 128 | 34:50 | 34:50 | 04:38:40 | 44:13 | 47:27 | 05:53:46 | 01:15:06 | 26% | | Keke Rosberg | 0 | 9 | 144 | 28:40 | 28:40 | 04:18:00 | 38:31 | 44:06 | 05:46:42 | 01:28:42 | 34% | | Damon Hill | 1 | 7 | 112 | 34:50 | 34:50 | 04:03:50 | 48:17 | 53:32 | 05:38:00 | 01:34:10 | 38% | | Nelson Piquet | 0 | 11 | 176 | 28:40 | 28:40 | 05:15:20 | 30:04 | 32:39 | 05:30:50 | 00:15:30 | 4% | | Lewis Hamilton | 1 | 8 | 128 | 34:50 | 34:50 | 04:38:40 | 39:32 | 51:12 | 05:16:18 | 00:37:38 | 13% | | Nigel Mansell | 1 | 8 | 128 | 34:50 | 34:50 | 04:38:40 | 39:25 | 46:25 | 05:15:24 | 00:36:44 | 13% | | Nico Rosberg | 1 | 8 | 128 | 34:50 | 34:50 | 04:38:40 | 38:55 | 43:50 | 05:11:22 | 00:32:42 | 11% | | Jackie Stewart | 0 | 10 | 160 | 28:40 | 28:40 | 04:46:40 | 30:55 | 34:32 | 05:09:14 | 00:22:34 | 7% | | Ayrton Senna | 0 | 10 | 160 | 28:40 | 28:40 | 04:46:40 | 30:09 | 35:47 | 05:01:36 | 00:14:56 | 5% | | Niki Lauda | 0 | 10 | 160 | 28:40 | 28:40 | 04:46:40 | 29:37 | 32:16 | 04:56:17 | 00:09:37 | 3% | | Kimi Raikkonen | 1 | 8 | 128 | 34:50 | 34:50 | 04:38:40 | 36:56 | 39:15 | 04:55:34 | 00:16:54 | 6% | | Michael Schumacher | 1 | 8 | 128 | 34:50 | 34:50 | 04:38:40 | 36:47 | 39:16 | 04:54:16 | 00:15:36 | 5% | | Jim Clark | 0 | 9 | 144 | 28:40 | 28:40 | 04:18:00 | 30:41 | 35:57 | 04:36:16 | 00:18:16 | 7% | | Mika Hakkinen | 1 | 7 | 112 | 34:50 | 34:50 | 04:03:50 | 37:52 | 42:09 | 04:25:05 | 00:21:15 | 8% | | Jack Brabham | 0 | 8 | 128 | 28:40 | 28:40 | 03:49:20 | 32:58 | 36:50 | 04:23:45 | 00:34:25 | 15% | | Emerson Fittipaldi | 0 | 9 | 144 | 28:40 | 28:40 | 04:18:00 | 28:40 | 28:40 | 04:18:00 | 00:00:00 | 0% | | Jochen Rindt | 0 | 8 | 128 | 28:40 | 28:40 | 03:49:20 | 31:45 | 35:30 | 04:14:03 | 00:24:43 | 10% | | Jenson Button | 1 | 7 | 112 | 34:50 | 34:50 | 04:03:50 | 35:54 | 38:02 | 04:11:21 | 00:07:31 | 3% | | James Hunt | 0 | 8 | 128 | 28:40 | 28:40 | 03:49:20 | 30:27 | 33:12 | 04:03:37 | 00:14:17 | 6% | | John Surtees | 0 | 8 | 128 | 28:40 | 28:40 | 03:49:20 | 30:24 | 33:49 | 04:03:19 | 00:13:59 | 6% | | Alberto Ascari | 2 | 12 | 108 | 18:00 | 18:00 | 03:36:00 | 18:03 | 18:35 | 03:36:37 | 00:00:37 | 0% | | Phil Hill | 2 | 10 | 90 | 18:00 | 18:00 | 03:00:00 | 19:53 | 21:06 | 03:18:59 | 00:18:59 | 10% | | Mike Hawthorn | 2 | 9 | 81 | 18:00 | 18:00 | 02:42:00 | 21:56 | 22:25 | 03:17:24 | 00:35:24 | 21% | | Timo Salonen | 3 | 10 | 80 | 15:45 | 15:45 | 02:37:30 | 19:16 | 20:21 | 03:12:47 | 00:35:17 | 22% | | Denny Hulme | 2 | 9 | 81 | 18:00 | 18:00 | 02:42:00 | 20:38 | 21:35 | 03:05:47 | 00:23:47 | 14% | | Alan Jones | 2 | 9 | 81 | 18:00 | 18:00 | 02:42:00 | 20:23 | 21:12 | 03:03:27 | 00:21:27 | 13% | | Giuseppe Farina | 2 | 9 | 81 | 18:00 | 18:00 | 02:42:00 | 19:36 | 20:28 | 02:56:27 | 00:14:27 | 8% | | Mario Andretti | 2 | 8 | 72 | 18:00 | 18:00 | 02:24:00 | 21:52 | 22:55 | 02:55:01 | 00:31:01 | 21% | | Jody Scheckter | 2 | 8 | 72 | 18:00 | 18:00 | 02:24:00 | 21:04 | 22:17 | 02:48:37 | 00:24:37 | 17% | | Miki Biasion | 3 | 9 | 72 | 15:45 | 15:45 | 02:21:45 | 18:21 | 19:03 | 02:45:11 | 00:23:26 | 16% | | Henri Toivonen | 3 | 10 | 80 | 15:45 | 15:45 | 02:37:30 | 16:04 | 16:36 | 02:40:46 | 00:03:16 | 2% | | Carlos Sainz | 3 | 9 | 72 | 15:45 | 15:45 | 02:21:45 | 17:50 | 18:31 | 02:40:37 | 00:18:52 | 13% | | Ari Vatanen | 3 | 8 | 64 | 15:45 | 15:45 | 02:06:00 | 19:57 | 21:00 | 02:39:40 | 00:33:40 | 26% | | Juan M. Fangio | 2 | 8 | 72 | 18:00 | 18:00 | 02:24:00 | 19:55 | 20:56 | 02:39:27 | 00:15:27 | 10% | | Stig Blomqvist | 3 | 9 | 72 | 15:45 | 15:45 | 02:21:45 | 16:46 | 17:20 | 02:30:57 | 00:09:12 | 6% | | Richard Burns | 3 | 8 | 64 | 15:45 | 15:45 | 02:06:00 | 17:49 | 19:09 | 02:22:36 | 00:16:36 | 13% | | Michele Mouton | 3 | 8 | 64 | 15:45 | 15:45 | 02:06:00 | 17:25 | 18:14 | 02:19:27 | 00:13:27 | 10% | | Petter Solberg | 3 | 7 | 56 | 15:45 | 15:45 | 01:50:15 | 15:46 | 16:06 | 01:50:23 | 00:00:08 | 0% | | Bruce McLaren | X | XX | XXX | XX:XX | XX:XX | XX:XX:XX | XX:XX | XX:XX | XX:XX:XX | XX:XX:XX | XX% | | Eddie Irvine | X | XX | XXX | XX:XX | XX:XX | XX:XX:XX | XX:XX | XX:XX | XX:XX:XX | XX:XX:XX | XX% | | Jean Alesi | X | XX | XXX | XX:XX | XX:XX | XX:XX:XX | XX:XX | XX:XX | XX:XX:XX | XX:XX:XX | XX% | +----------------------+---+----+-----+-------+-------+----------+-------+-------+----------+----------+-----+
./main --line-stats
Implementujte výpis seznamu stanic linek se statistikam zpoždění ve formátu:
+------------------------------------------------------------------------------------------------------------------------------------------------+ | Line: L | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | rT | ==> | D-avg | D-max | D-min | nE | E-max || rT | <== | D-avg | D-max | D-min | nE | E-max | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | 00 | Zastavka(0) | 00:00 | 00:00 | 00:00 | 0 | 00:00 || ## | Zastavka(N) | mm:ss | mm:ss | mm:ss | ## | mm:ss | | ## | Zastavka(1) | mm:ss | mm:ss | mm:ss | ## | mm:ss || ## | Zastavka(N-1) | mm:ss | mm:ss | mm:ss | ## | mm:ss | <<< Zde jsou radky pro vsechny zastavky>>> | ## | Zastavka(N) | mm:ss | mm:ss | mm:ss | ## | mm:ss || ## | Zastavka(0) | 00:00 | 00:00 | 00:00 | 0 | 00:00 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+
Obsah sloupců/polí je:
rT
Ukázka výstupu pro výše zmíněné volání je v poskytnutém souboru output5.txt nebo zde:
output5.txt
Loaded 45 names from driver_list.txt. Loaded network from network.txt. Loaded departure database from departures.txt. +------------------------------------------------------------------------------------------------------------------------------------------------+ | Line: 0 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | rT | ==> | D-avg | D-max | D-min | nE | E-max || rT | <== | D-avg | D-max | D-min | nE | E-max | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | 00 | U Petnika | 00:00 | 00:00 | 00:00 | 0 | 00:00 || 00 | Studijni odd. | 00:00 | 00:00 | 00:00 | 0 | 00:00 | | 03 | Pred Menzou | 00:22 | 03:18 | 00:00 | 1 | 00:04 || 02 | Rektorat | 00:07 | 00:55 | 00:00 | 0 | 00:00 | | 05 | Matematiku | 00:27 | 03:56 | 00:00 | 0 | 00:00 || 03 | Dekanat | 00:13 | 01:39 | 00:00 | 0 | 00:00 | | 07 | Fyziku | 00:34 | 04:22 | 00:00 | 1 | 00:16 || 06 | Knihovnicka | 00:09 | 01:36 | 00:00 | 0 | 00:00 | | 09 | Radioelektronicka | 00:40 | 04:28 | 00:00 | 3 | 01:12 || 08 | U Bufetu | 00:26 | 02:25 | 00:00 | 0 | 00:00 | | 10 | Elektromagnetickeho pole | 00:51 | 04:32 | 00:00 | 0 | 00:00 || 10 | U Zavrene skoly | 00:49 | 04:02 | 00:00 | 0 | 00:00 | | 12 | Mikroelektronicka | 01:11 | 05:08 | 00:00 | 0 | 00:00 || 11 | Nosterova | 01:09 | 04:54 | 00:00 | 0 | 00:00 | | 14 | Studentska | 01:49 | 07:14 | 00:00 | 1 | 00:08 || 13 | Paterova | 01:15 | 04:53 | 00:00 | 0 | 00:00 | | 15 | Paterova | 02:18 | 07:56 | 00:00 | 0 | 00:00 || 14 | Studentska | 01:47 | 06:18 | 00:00 | 0 | 00:00 | | 16 | Nosterova | 02:20 | 09:08 | 00:00 | 0 | 00:00 || 16 | Mikroelektronicka | 01:59 | 07:01 | 00:00 | 0 | 00:00 | | 18 | U Zavrene skoly | 02:34 | 10:02 | 00:00 | 0 | 00:00 || 18 | Elektromagnetickeho pole | 02:20 | 08:09 | 00:00 | 0 | 00:00 | | 20 | U Bufetu | 03:17 | 12:06 | 00:00 | 0 | 00:00 || 19 | Radioelektronicka | 02:27 | 08:39 | 00:00 | 0 | 00:00 | | 22 | Knihovnicka | 03:07 | 12:44 | 00:00 | 0 | 00:00 || 21 | Fyziku | 02:29 | 09:17 | 00:00 | 0 | 00:00 | | 24 | Dekanat | 03:18 | 13:41 | 00:00 | 0 | 00:00 || 23 | Matematiku | 02:19 | 11:12 | 00:00 | 1 | 00:34 | | 26 | Rektorat | 03:20 | 15:02 | 00:00 | 0 | 00:00 || 25 | Pred Menzou | 02:23 | 11:41 | 00:00 | 1 | 00:08 | | 28 | Studijni odd. | 03:22 | 15:26 | 00:00 | 0 | 00:00 || 28 | U Petnika | 02:40 | 11:44 | 00:00 | 0 | 00:00 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ +------------------------------------------------------------------------------------------------------------------------------------------------+ | Line: 1 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | rT | ==> | D-avg | D-max | D-min | nE | E-max || rT | <== | D-avg | D-max | D-min | nE | E-max | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | 00 | Italska | 00:00 | 00:00 | 00:00 | 0 | 00:00 || 00 | Spanelska | 00:00 | 00:00 | 00:00 | 0 | 00:00 | | 03 | Desinfekcni | 00:31 | 01:54 | 00:00 | 0 | 00:00 || 02 | V Karantene | 00:23 | 03:10 | 00:00 | 1 | 00:13 | | 06 | Lihovar | 00:45 | 02:52 | 00:00 | 1 | 00:08 || 04 | Na Ventilaci | 00:45 | 03:39 | 00:00 | 2 | 00:19 | | 09 | Za Filtrem | 01:30 | 05:54 | 00:00 | 0 | 00:00 || 06 | Infekcni | 00:46 | 05:24 | 00:00 | 2 | 00:04 | | 12 | Testovaci | 01:59 | 10:05 | 00:00 | 0 | 00:00 || 08 | Svepomoci | 00:55 | 06:13 | 00:00 | 0 | 00:00 | | 14 | Respiratoru | 01:31 | 09:40 | 00:00 | 0 | 00:00 || 10 | Remdesivirova | 01:41 | 07:44 | 00:04 | 0 | 00:00 | | 16 | Petrackovo namesti | 02:11 | 11:03 | 00:01 | 0 | 00:00 || 12 | Prymulova | 02:01 | 08:35 | 00:04 | 0 | 00:00 | | 18 | Ochrannych stitu | 03:10 | 13:33 | 00:16 | 0 | 00:00 || 14 | U Zavrene skoly | 02:29 | 09:08 | 00:13 | 0 | 00:00 | | 20 | U Zavrene skoly | 03:38 | 14:53 | 00:16 | 0 | 00:00 || 16 | Ochrannych stitu | 03:07 | 12:15 | 00:03 | 0 | 00:00 | | 22 | Prymulova | 04:26 | 15:18 | 00:14 | 0 | 00:00 || 18 | Petrackovo namesti | 03:20 | 13:58 | 00:00 | 0 | 00:00 | | 24 | Remdesivirova | 04:57 | 17:08 | 00:20 | 0 | 00:00 || 20 | Respiratoru | 03:39 | 13:37 | 00:00 | 1 | 00:13 | | 26 | Svepomoci | 05:06 | 17:12 | 00:15 | 0 | 00:00 || 22 | Testovaci | 03:55 | 14:29 | 00:00 | 0 | 00:00 | | 28 | Infekcni | 05:08 | 17:19 | 00:00 | 0 | 00:00 || 25 | Za Filtrem | 04:22 | 15:12 | 00:00 | 0 | 00:00 | | 30 | Na Ventilaci | 05:04 | 17:37 | 00:00 | 0 | 00:00 || 28 | Lihovar | 04:23 | 15:12 | 00:00 | 0 | 00:00 | | 32 | V Karantene | 05:11 | 17:55 | 00:00 | 0 | 00:00 || 31 | Desinfekcni | 04:51 | 15:54 | 00:00 | 0 | 00:00 | | 34 | Spanelska | 05:03 | 18:42 | 00:00 | 0 | 00:00 || 34 | Italska | 05:01 | 16:51 | 00:00 | 0 | 00:00 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ +------------------------------------------------------------------------------------------------------------------------------------------------+ | Line: 2 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | rT | ==> | D-avg | D-max | D-min | nE | E-max || rT | <== | D-avg | D-max | D-min | nE | E-max | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | 00 | Vitkov | 00:00 | 00:00 | 00:00 | 0 | 00:00 || 00 | Maternovy sady | 00:00 | 00:00 | 00:00 | 0 | 00:00 | | 02 | Dobesova alej | 00:16 | 00:52 | 00:00 | 2 | 00:08 || 02 | Pani Vyborne | 00:18 | 00:59 | 00:00 | 0 | 00:00 | | 04 | Navratilova | 00:33 | 01:23 | 00:00 | 0 | 00:00 || 04 | Petrackovo namesti | 00:36 | 01:21 | 00:00 | 0 | 00:00 | | 06 | Nentvichova | 00:51 | 02:12 | 00:00 | 0 | 00:00 || 06 | Patova trida | 00:54 | 01:57 | 00:00 | 0 | 00:00 | | 09 | Studentska | 01:05 | 02:24 | 00:00 | 0 | 00:00 || 09 | Studentska | 01:13 | 02:47 | 00:00 | 0 | 00:00 | | 11 | Patova trida | 01:17 | 02:47 | 00:00 | 0 | 00:00 || 11 | Nentvichova | 01:33 | 03:01 | 00:00 | 0 | 00:00 | | 13 | Petrackovo namesti | 01:37 | 03:16 | 00:00 | 0 | 00:00 || 13 | Navratilova | 01:47 | 03:26 | 00:00 | 0 | 00:00 | | 15 | Pani Vyborne | 01:55 | 04:10 | 00:00 | 0 | 00:00 || 15 | Dobesova alej | 02:03 | 03:54 | 00:00 | 0 | 00:00 | | 18 | Maternovy sady | 02:11 | 04:55 | 00:00 | 1 | 00:15 || 18 | Vitkov | 02:20 | 04:25 | 00:00 | 0 | 00:00 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ +------------------------------------------------------------------------------------------------------------------------------------------------+ | Line: 3 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | rT | ==> | D-avg | D-max | D-min | nE | E-max || rT | <== | D-avg | D-max | D-min | nE | E-max | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+ | 00 | Svepomoci | 00:00 | 00:00 | 00:00 | 0 | 00:00 || 00 | Posledni role | 00:00 | 00:00 | 00:00 | 0 | 00:00 | | 02 | Dobrovolniku | 00:17 | 00:57 | 00:00 | 0 | 00:00 || 02 | Papirenske zavody | 00:15 | 00:56 | 00:00 | 1 | 00:01 | | 04 | Lekaru | 00:30 | 01:19 | 00:00 | 0 | 00:00 || 04 | Bezrouskova | 00:36 | 01:35 | 00:00 | 0 | 00:00 | | 06 | Svadlen | 00:47 | 01:55 | 00:00 | 0 | 00:00 || 06 | Cesko-cinskeho pratelstvi | 00:55 | 02:33 | 00:00 | 0 | 00:00 | | 09 | Cesko-cinskeho pratelstvi | 01:07 | 02:34 | 00:00 | 0 | 00:00 || 09 | Svadlen | 01:13 | 03:00 | 00:00 | 0 | 00:00 | | 11 | Bezrouskova | 01:24 | 03:20 | 00:00 | 0 | 00:00 || 11 | Lekaru | 01:31 | 03:37 | 00:00 | 0 | 00:00 | | 13 | Papirenske zavody | 01:40 | 03:58 | 00:00 | 0 | 00:00 || 13 | Dobrovolniku | 01:48 | 04:32 | 00:00 | 0 | 00:00 | | 15 | Posledni role | 01:55 | 04:36 | 00:00 | 0 | 00:00 || 15 | Svepomoci | 02:02 | 05:15 | 00:00 | 1 | 00:31 | +----+-----------------------------+-------+-------+-------+----+-------++----+-----------------------------+-------+-------+-------+----+-------+
Váš kód se bude porovnávat s referenčním řešením podle následujících kritérií:
::
using namespace std;
+
-
*
/
«
»
&
%
=
;
(
)
[
]
{
}
main.cpp, doprava.hpp, doprava.cpp, datové soubory, výstupy: HW04.zip.
Odevzdávaný zip soubor pojmenujte main.zip.
main.zip
--schedule [seznam zastavek]
--line-routing
--driver-delays
--driver-duty
--line-stats