Here is the loop:
Code:
int poly, argument, coefficient, exponent;
char colon = ':';
char assignment = '=';
char multiply = '*';
while(INPUTFILE && INPUTFILE.peek() != EOF)
{
getline(INPUTFILE, theTerms);
iss.str(theTerms);
if(iss >> poly >> colon)
{
locationOfPoly = poly;
while(iss >> coefficient >> exponent)
{
tPoly.insert(exponent, coefficient);
}
//postcondition: all info has been extracted from iss so assign tmpPoly
//to Poly[locationOfPoly]
Poly[locationOfPoly] = tPoly;
}
if(iss >> poly >> assignment >> poly >> multiply >> poly)
{
Poly[poly] = Poly[poly] * Poly[poly];
}
if(iss >> show >> poly)
{
locationOfPoly = poly;
cout <<"Poly[" << locationOfPoly << "] = " << Poly[locationOfPoly] << "\n";
}
}//end while INPUTFILE loop