I have a data text file which contains this
Map2D, [3, 2]
Dot3D, [25, -69, -33], [-2, -41, 58]
Map3D, [6, 9, -50]
Map2D, [3, 2]
Dot3D, [7, -12, 3], [9, 13, 6
You can use the cin to get the filename, but then you should write a helper method that can parse the file.
My suggestion would be to create a class called DataMembers or something like that. In that class you can have a helper method that reads in a data member file. The class could have 4 vectors for storing the data you read from the file.
class DataMembers
{
private:
std::vector _map2Ds;
std::vector _map3Ds;
....
public:
void readDataFile(std::string inFileName);
void writeDataFile(std::string outFileName);
};
The readDataFile method should do the following
You would probably want to write some other private methods to handle the creation of the data types and assigning to the proper collections.