I'm trying to read a text file into a do while loop. For some reason I can't get it to countinue until ants = 0 . there are two different simulations, once ants go to o the counter needs to reset and do another simulation. Can someone help me?
the text file looks like this
50000 1
100000 25
90000 25
Code:
int main ()
{
int ants; // gets the integer on the data line
ifstream inFile; // get the text file for decryption
int count = 0;
int yards = 0;
int inFileLoop = 0;
int band = 10000;
if(!inFile)
{
std::cout<<"Could not open file"<<std::endl;
}
inFile.open("antsData.txt");
if(inFile)
inFile >> ants;
inFile >> yards;
do
{
cout << " Time Elapsed Stadium Devoured Surviving Ants " << endl;
cout << " in min. in yds. " << endl;
for(count = 0; count <= 0; count++)
for(yards = 0; yards <= 0; yards++)
//prints out the time elapsed, yards, and antsber of ants
cout << " " << count << " " << yards << " " << ants << endl;
cout << " " << count << " " << yards << " " << ants - band <<
" Band stomps 10000 ants. " << endl;
}
while(inFile.eof());
inFile.clear();
inFile.close();
// print a closing message and exit program
cout << endl << "-=- Execution Terminated -=-" << endl << endl;
cout << "==================================================" << endl
<< endl;
return 0;
}