As an example input file:
02-03-2004,13045634
03-02-2004,16782930
I'm having trouble coming up with code that can read in inputs into different arrays properly. My most recent attempt is this:
int i = 0;
if(inputFile.is_open()){
while(!inputFile.eof() && i < arraySize){
getline(inputFile, line, ',');
date[i] = line; //array of type string
getline(inputFile, line, ',');
deaths[i] = line; //array of type int
//...
i++;
}
}
I'm struggling to figure out how exactly I'm supposed to move through the input file with the delimiter of ',' while storing everything correctly.
The array I'm trying to read into is a dynamic array, where I already have a function made that determines the size of the array through getline
I also have to keep the ints as ints because there are functions that need to do calculations with them
As a side note, I can't use vectors for this because they haven't been covered in my class yet