#1
Code:
#include <time.h>
#include <stdlib.h>
You should prefer these ones:
Code:
#include <ctime>
#include <cstdlib>
#2 Methods which do not modify the class, such as your "get" member functions should be declared as const, i.e.:
Code:
int getnnconfig() const
{
return nnconfig;
}
int getclustersize() const
{
return clustersize;
}
#3 On to the meat of your question... you should be able to easily use one of the readily available STL container classes to hold all of your vacancylist objects. These containers, such as list/vector/deque, can grow automatically to accommodate as many objects as you would need.
#4
Code:
vacancylist(int nn, int cs, int cn, int x, int y, int z, int nb, int nb2, double nb3, double tx,
double ty, double tz)
{
nnconfig=nn;
clustersize=cs; //cs=cluster size
clusterno=cn; //cn=cluster no
xcoord = x;
ycoord = y;
zcoord = z;
note=nb;
note2=nb2;
note3=nb3;
tempx=tx;
tempy=ty;
tempz=tz;
}
vacancylist()
{
nnconfig= 0;
clustersize=0;
clusterno=0;
xcoord = 0;
ycoord = 0;
zcoord = 0;
note=0;
note2=0;
note3=0;
tempx=0;
tempy=0;
tempz=0;
}
The above two constructors can be combined into a single constructor that uses default arguments... also, where possible, initialization lists should be used to initialize the class's data members:
Code:
vacancylist(int nn = 0, int cs = 0, int cn = 0, int x = 0, int y = 0, int z = 0, int nb = 0,
int nb2 = 0, double nb3 = 0.0, double tx = 0.0, double ty = 0.0,double tz = 0.0) : nnconfig(nn),
clustersize(cs), clusterno(cn), xcoord(x), ycoord(y), zcoord(z), note(nb), note2(nb2),
note3(nb3), tempx(tx), tempy(ty), tempz(tz)
{
}