I have a file structured as follows:
A 123456 0
G 123456 5
A 235334 0
B 123456 2
Each information is stored as follows:
temp.code >> temp.personid >> temp.data
I saved this information in Vector
ifstream fin("test.txt");
vector<TestClass> test;
TestClass temp;
string line;
while (getline(fin, line)) {
This person can appear many times in the file. What I want to do is iterate over the vector and group the repeats into one class object per person, my goal is that I want to summarize the data for each specific object, so the output for the file is higher:
123456 : 7
235334 : 0
What would be an elegant way to approach this?
thank
source
share