Hello everybody,
In the following code, please suggest me to use alternative to array of objects.
I dont want to use interaction ia[11000] in the above program
means I dont want to specify fixed object. I even dont want
interaction* ia[11000]
Is there any other solution?
Hi, Banfa!!!
I'm not able to solve my previous query.
I'm still looking any suggestion from you.
Thanks
Rajeev
In the following code, please suggest me to use alternative to array of objects.
Code:
//defined in x.h class interaction { public : int idnumber; int conditionnum; int substructurenum; int damage; int referencenum; int nextsamehashvalue; int otherreactingss1; int otherreactingss2; int firstrelativerate; // constructor interaction() : idnumber(0), conditionnum(0), substructurenum(0), damage(0), referencenum(0), nextsamehashvalue(0), otherreactingss1(0), otherreactingss2(0), firstrelativerate(0) {} }; //defined in x.cpp interaction ia[11000]; //declared globally void readinteraction() //declared globally { for(int i=0; i<11000; ++i) { //here I will access each object of class //interaction via ia and put some value in //each member variables defined in that class } } int main() { readinteraction(); ofstream ialist(filename); //filename is a file where I will //write all the object(i.e ia contents) ialist.write((char *) ia,sizeof(ia)); ialist.close(); return 0; }
means I dont want to specify fixed object. I even dont want
interaction* ia[11000]
Is there any other solution?
Hi, Banfa!!!
I'm not able to solve my previous query.
I'm still looking any suggestion from you.
Thanks
Rajeev
Comment