Exemplo n.º 1
0
void Vector::readAirports()
{
  char line[1000];
  char state[40];
  City city;
  ifstream fp;
  fp.open("airportLL.txt");
  
  while (fp.getline(line, 1000))
  {
    if (isalpha(line[0]))
      strcpy(state, line);
    
    if (line[0] == '[')
    {
      city.readAirport(line, state);
      
      for (int i = 0; i < count; i++)
        if (cityArray[i].isEqual(&city))
        {
          cityArray[i].copyLocation(&city);
          //cout<<cityArray[i].name;
          break;
        }  // if found a matching name
      
      city.deallocate();
    }  // if an airport line
  }  // while
}  // readAirports()
Exemplo n.º 2
0
void Vector::readAirports()
{
  char line[1000], state2[80];
  City city;
  ifstream inf("airportLL.txt");

  while (inf.getline(line, 1000))
  {
    if (isalpha(line[0]))
      strcpy(state2, strtok(line, "\n"));
    
    if (line[0] == '[')
    {
      city.readAirport(line, state2);
      
      for (int i = 0; i < count; i++)
        if (cityArray[i].isEqual(&city))
        {
          cityArray[i].copyLocation(&city);
          break;
        }  // if found a matching name
      
      city.deallocate();
    }  // if an airport line
  }  // while
}  // readAirports()