I have a class with fields like firstname, age, school, etc. I need to be able to store other information, such as where they traveled and what year it was. I cannot declare another class specifically for storing travelDestination and in which year, so I think the structure could be better. This is just an example:
struct travel {
string travelDest;
string year;
};
The problem is that people probably traveled for different amounts. I thought I had an array of travel structures for storing data. But how to create a fixed-size array to store them without knowing how big I need it?
Maybe I'm going to do it completely wrong, so any suggestions for a better way would be appreciated.
I understand that there is essentially no difference between a class and a structure, but for the purpose of the assignment criteria I am not allowed to have a “class”, so yes.
source
share