Entire source is a little big. Here are the class and first part of main (where it is declared)
Code:
#include <iostream>
#include <iomanip>
enum dirs { E = 0, NE, N, NW, W, SW, S, SE };
using namespace std;
class Zone
{
int connections[8];
public:
Zone(){
for (int i=0; i < 8; i++)
connections[i] = -1;
}
void addconn(int p, int z)
{
if ( connections[p] == -1 )
{
connections[p] = z;
}
}
int getconn(int p)
{
return connections[p];
}
void setnum(int x)
{
num = x;
}
int getdir (void)
{
for (int i=0; i < 8; i++)
if ( connections[i] == -1 )
return i;
return -1;
}
};
Code:
int main(void)
{
const int size = 80;
int base = 0;
int next = 1;
int dir;
Zone *zones = new Zone[size];
If I change
Code:
Zone *zones = new Zone[size];
to It produces the following
bubbletest.cpp: In function `int main()':
bubbletest.cpp:76: warning: deleting array `class Zone zones[80]'