ifstream infile;
infile.open(filename);
if(!infile) {
cout<< "Sorry Bad File. Run again with different file name " <<endl;
exit(0);
}
else {
cout<<"Reading file..." << endl;
}
Stack change;
int temp[16];
int i=0;
while(!infile.eof())
{
infile>>temp[i];
//change.push(temp[i]);
i++;
}
infile.seekg(0);
for(i=0;i<10;i++) {
cout<<temp[i]<< " "; /* point of this for is just to see what is being stored in the file */
}
contents of the file:
1, 10, 10, 5, 1, 25
honestly, it should work I just done see why it won't like all it is supposed to be doing is reading inputs from the file