the readMe.ingredients is a pointer to an array of Ingredient objects that has an overloaded >> operator. The delimiter for the >> operator is a newline character.
Suppose the list of ingredients is formatted like this:
- 4 gal chocolate ice cream
- 3 gal butterscotch syrup
- 12 pint sliced
bananas
for (int count = 0; count < readMe.numIngredients; count++)
{
in >> readMe.ingredients[count];
// the loop continues until you finish with all of the ingredients
}
in.ignore(10000,'\n');
That’s some example code for parsing the ingredient list above. But wouldn’t you want in.ignore(10000,'\n') inside the loop instead of outside in order for this to work? If not, then why should it be outside?
nevermind I think I got it. There’s a blank line after the ingredient list
But wouldn’t you still want
in.ignore(10000,'\n')in the loop in order to go to the next line? Wouldn’t it just keep assigning4 gal chocolate ice creamto each item in the array?