In C++, I have to read zip codes from a file. While there are zip codes in the file, I need to search the array (of Structs) until either a matching zip code or the "end" of the array has been found. If the zip code exists in the array, I have to increment the appropriate count by 1. If not, I have to put the zip code into the array at the "end" and set the count to 1. Then I have to get the next zip code from the input file. Here's my code so far:
Use: This function will read the file of data and fill
the array.
Arguments: 1. City[] : array of City structures
Returns: number of valid cities that were in the input file
***************************************************************/
int buildArray( City cityAr[] )
{
ifstream inFile;
int num, i;
This code results in 560 individual lines of zip codes. Any duplicates in the file should not be added again, but rather, incremented in their cityAr[i].count