I'm a new learner of C++. I have some data saved in Data.csv like this:
     S0001       S0002     S0003   S0004    ...
0   10.289461  17.012874         
1   11.491483  13.053712         
2   10.404887  12.190057          
3   10.502540  16.363996  ...        ...
4   11.102104  12.795502         
5   13.205706  13.707030         
6   10.544555  12.173467         
7   10.380928  12.578932        
...    ...         ...         ...     ...  
I need values column by column to do calculations (column average, moving average, etc), so I want to parse by columns and save them into arrays.
I read these answers but didn't find what I want. What I did is
void read_file(std::vector<std::string>& v, std::string filename){
    std::ifstream inFile(filename);
    std::string temp;
    if (!inFile.is_open()) {
        std::cout<<"Unable to open the file"<<std::endl;
        exit(1);
    }
    while (getline(inFile, temp)) {
        v.push_back(temp);
    }
    inFile.close();
}
int main()
{
    std::string filename = "Book1.csv";
    std::vector<std::string> vec;
    read_file(vec, filename);
    std::cout<<vec[1]<<std::endl;
 }
I can only get values line by line. But how can I parse the file and get values by column?
 
    