Friday, 16 August 2013

How would I read a file into an multidimensional array or three seperate arrays based on a sequence of delimiters?

How would I read a file into an multidimensional array or three seperate
arrays based on a sequence of delimiters?

New to c++ and programming, and I am having trouble figuring this out.
Pseudo idea; Assuming I can define the delimiters
',' ',' '\n'
then read file line by line while adding each element to each array.
#define ARRAY_SIZE 1000
string someString[ARRAY_SIZE];
double someDoubble[ARRAY_SIZE];
double someDoubble[ARRAY_SIZE];
Then the text file that I am reading is
somestring, someDouble, someDouble\n
Or in other words the delimiters are comma, comma, newline char.

No comments:

Post a Comment