Recursive Solution to Network Redundancy Problem

#include < fstream.h >
#include < iostream.h >
#include < stdlib.h >
#include < stdio.h >

...
Note: The Stack, Array, City, Cell classes are exactly the same as in the previous solution. All the new stuff is given below. The visited and links arrays are defined globally to avoid clutter in the argument list of the redundancy function.
...

#define MAX_CITIES 200

Array *visited = new Array(MAX_CITIES);
Array *links = new Array(MAX_CITIES, MAX_CITIES);
int cities;

int redundancy(int current, int parent)
{
   int i;

   visited->put(current, 1);
   for (i=0 ; i < = cities ; i++)
   {
      if (!links->get(current,i) || current == i) continue;
      if (!visited->get(i))
      {
         if (redundancy(i,current)) return 1;
      }
      else
      if (i != parent) return 1;
   }
   return 0;
}

int main(int argc, char **argv)
{
   char *buffer = new char[128];
   int city1, city2, cost;

   if (argc != 2) exit(0);
   fstream fin(argv[1], ios::in);
   while (fin.getline(buffer, 128, '\n'))
   {
      sscanf(buffer, "%d%d", &city1, &city2);
      links->put(city1,city2,1);
      cities = max(max(cities, city1), city2);
   }
   fin.close();

   printf("((%d))\n",redundancy(0,-1));

   return 1;
}