mercredi 19 avril 2017

How to get values specifically from a text file?

I have this text file a.txt :

1.10 3.01 5.0
4.15 5460 78123
7.1 4.18 93.6

And what I want is to put the three column in vector. I mean like this :

a = 1.10, 4.15, 7.1
b = 3.01, 5460, 78123
c = 7.1, 4.18, 93.6

Is it possible to save the values like this ?

Right now i just read the file like this :

std::ifstream myFile("a.txt");
std::string line;
while(getline(myFile, line)){
std::cout << line << std::endl;
}

Thank you a lot !

Aucun commentaire:

Enregistrer un commentaire