-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVectorMyJosephus.hpp
46 lines (40 loc) · 1.24 KB
/
VectorMyJosephus.hpp
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
#pragma once
#include "Destination.hpp"
#include <fstream>
#include <vector>
class VectorMyJosephus
{
public:
// Constructor
// Takes two ints -
// an M value to control how many spaces are advanced
// an N value to set how many destinations there are at the start
VectorMyJosephus(const int MVal, const int NVal);
// Destructor
~VectorMyJosephus();
// Make the vector empty
void clear();
// Return the current size of the vector (int)
int currentSize() const;
// Returns true if the vector is empty (bool)
bool isEmpty() const;
// Destroys a destination in the vector
// Returns a copy of the deleted destination
Destination eliminateDestination();
// Prints all remaining destinations in the vector
void printAllDestinations() const;
// Get the current round
int currentRound() const;
private:
// Current round of eliminations
int round;
// Interval of elimination
int M;
// Number of starting locations
int N;
// Vector of destinations to choose from
std::vector<Destination> destinations;
// Parses a given string into the destination vector
// Takes a reference to a filestream
void parseDestinations(std::ifstream& line);
};