#include "popunit.h" #include "main.h" #include "stack.h" void initialize_tracts(class Popunit *tracts, const string& filename) { FILE *fin; int num_tracts,i,pop; string st_name; char name[50]; float wcoord,ncoord; fin = fopen(filename.data(),"r"); if(NULL == fin) { cerr<<"unalbe to open " << filename.data()<<" \n"; throw "aborting! \n"; } fscanf(fin,"%d\n", &num_tracts); tracts = new (Popunit)[num_tracts]; for(i = 0; i< num_tracts; i++) { fscanf(fin,"%s%f%f%d\n",name,&wcoord,&ncoord,&pop); tracts[i].set(wcoord, ncoord, pop, i, name); } } int main (void) { Stack a(5),b(10); int i; Popunit *tracts; initialize_tracts(tracts, "tract.inp"); for(i = 0; i< 6; i++) { a.push(i); } cout<< "is 6 in a?\n"; cout<< "the answer is" << a.is_in(6)<< "\n"; }