I'm trying to write a program where I have a vector of enrollees (or patients w/ health insurance to be more specific) named enrollVector, and basically what I want to do right now is to loop thru my enrollVector, and if at any point, any of them have the same userid AND insurance, then I need to delete the enrollee with the lower version (if they’re the same then either keep them both or just delete one of them).
Imagine that my vector of enrollees is filled with the following data.
nm92,Nate,Matthews,Aetna,1
sc91,Steve,Combs,Cigna,2
ml94,Morgan,Lands,BCBS,3
kb93,Kyle,Borris,Aetna,2
ai90,Alik,Inter,BCBS,4
nm92,Nick,Maple,Aetna,3
This will obviously require a nested for loop, but I’m struggling with how to do the comparisons accurately within my vector, while also avoiding the case where I compare the same enrollee and end up deleting everything. I’ve commented out my loop where I attempt this because it is broken.
My struct of enrollees shown below:
struct enrollee
{
string userid = "";
string fname = "";
string lname = "";
string insurance = "";
string version = "";
};
What would be the best way to accomplish my goal here with this given vector of structs? I think I’m mixing myself up.
Aucun commentaire:
Enregistrer un commentaire