C++ csv read and save

  2d, c++, csv, vector

i am a beginner in programming and would need help with the task.
Now the class is to be tested: In the file data.csv you will find training data in csv format (1,column: x values, 2nd column: y values). Read in the data and save the values in the float vectors x and y.

34.729,156.885
8.592,53.441

I can just with these include work : iostream, iomanip, vector, cmath, fstream, sstream, string, vector, regex, filesystem

I tried to write code.

int main(){

    float x,y;
    std::ifstream c;
    csvread.open("data.csv", ios::in);
    if(!csvread.is_open()) cerr << "False!" << endl;
    else{
        while(!csvread.eof()){
            getline(csvread, x, ';');
            getline(csvread, y, 'n');
        }
        csvread.close();
    }
    return 0;
}

Source: Windows Questions C++

LEAVE A COMMENT