nm92,Nate,Matthews,Aetna,1
sc91,Steve,Combs,Cigna,2
ml94,Morgan,Lands,BCBS,3
kb93,Kyle,Borris,Aetna,2
I am trying to take a CSV input file like above, store it, sort it by insurance (col 4), and then write it to diff files based on insurance but in alphabetical order by last name.
So in this program, I have a vector of uniqueInsurances, which in turn have a vector of enrollees. It is this vector of enrollees that I want to sort alphabetically by last name (col 3), so that if uniqueInsurances[0].name is Aetna, then uniqueInsurances[0].enrollees[] will have Kyle Borris listed BEFORE Nate Matthews. Right now I have it stored the other way with Nate Matthews listed before Kyle Borris.
I think it's due to the vector of vectors and nested for loops required for this problem that's getting me mixed up, so I was wondering if someone could help guide me in terms of the best way to sort the enrollee vectors for each uniqueInsurance?
struct enrollee
{
string userid = "";
string fname = "";
string lname = "";
string insurance = "";
string version = "";
};
struct uniqueInsurance
{
string name = "";
int numEnrollees = 0;
vector <enrollee> enrollVector;
};