I have an array:
const string ARRAY[][3] = {
{"Kolkata","Mumbai","218"},
{"Kolkata","New Delhi","316"},
...
{"Mumbai","Chennai","715"},
{"Chennai","Bangalore","516"},
};
This was a convenient way to store the entire table because I knew how many rows I had. However, in the future, the data needs to be read from a file, which can and will be edited by anyone.
I thought of creating a struct, something like:
typedef struct row {
string col1;
string col2;
string col3;
} row_t;
and then creating a vector<row_t>
. Is this a good idea? Is there an easier way of doing this using an stl container? I also thought of creating a table large enough to last for a while (the number of rows does not change that often), but that does not feel right..
Thanks!