mardi 17 mars 2020

how to read a matrix from a input stream in C++?

I have an input from isstream

1 2
3 4
5 6

I would like to populate this from isstream overloading the >> operator

the input would be something like

Matrix m;
string input = "1 2 \n 3 4\n 5 6\n";
istringstream ss(input);
ss >> m;

how do I implement the >> operator to parse the matrix from isstream?

Aucun commentaire:

Enregistrer un commentaire