Hi,
I have an unknown amount of lines, such as the following text:
dog 2 4 2 biscuits wet
cat 5 4 4 biscuits wet dry whiskers
bird 1 2 7 birdseed peanuts bread oats worms insects crackers
I need to feed this into a struct, such as
Code:
struct animal
{
char animalName[10];
int age;
int numberOfLegs;
int favoriteFoodAmount;
*Some way to store favorite foods*
}
The last number defines how many favorite foods there are.
I need to be able to store favorite foods. I assume the way to do this would be via an array of char arrays but I have no idea how to do this, or how to implement reading in that text.
Could anyone please give me some pointers on how to do this?
Thanks
Daniel Colthart