-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
60 lines (54 loc) · 1.1 KB
/
main.cpp
File metadata and controls
60 lines (54 loc) · 1.1 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
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;
struct Player
{
int id; //an id to use as a name
bool is_healer; // if this player is a healer
int perSecond; // either hps or Pdps, depending on player type
int health; //health
};
vector<Player> sort(vector<Player> &input, int Bdps)
{
//implement here
return input;
}
void print(vector<Player> p)
{
for (Player i : p)
cout << i.id << " ";
cout << endl;
}
int main(int argc, char *argv[])
{
if (argc < 2)
{
cout << "Please provide an input file" << endl;
return 1;
}
ifstream is(argv[1]);
vector<Player> original;
int p = 0;
is >> p;
int Bdps = 0;
is >> Bdps;
for (int i = 0; i < p; i++)
{
Player pl;
int ids = 0;
is >> ids;
pl.id = ids;
int b = 0;
is >> b;
pl.is_healer = b;
int ps = 0;
is >> ps;
pl.perSecond = ps;
int hp = 0;
is >> hp;
original.push_back(pl);
}
print(sort(original, Bdps));
}