Hey,
jlb, the OP’s question isn’t perfectly-formed English, but it does show both input file formats — one of which is a state/area code/zip table.
If this looked like a work work kind of problem, I would recommend the OP to Google’s libphonenumber.
@
jakerg777
You need to create either a struct or three individual arrays and load your lookup table into memory so that it can be searched.
1 2 3 4 5 6 7 8 9
|
int MAX_LOOKUPS = 1000; // or 50? IDK
struct
{
string state, area_code, zip;
}
lookup[MAX_LOOKUPS];
int count = 0;
| |
1 2 3 4 5 6 7
|
int MAX_LOOKUPS = 1000; // or 50? IDK
string states[MAX_LOOKUPS];
string area_codes[MAX_LOOKUPS];
string zips[MAX_LOOKUPS];
int count = 0;
| |
I put a whole lot of look-ups, I don’t know how many you actually need. Take a look at your file.
Load that file into the structure/arrays, keeping track of how many items you have in
count
.
THEN work on your input file. For each line you read, separate it into names, phone, and state. Find the state in your lookup array(s), then print all the new information.
Good luck!