[HELP] Get matrix from user in specific format

I'm creating a program which will perform a variety of operations on a user defined matrix.

I want to user to enter the matrix in the form:
A = [1 2 3 4; 5 6 7 8; 9 1 2 3]

which would equate to:
A=
1 2 3 4
5 6 7 8
9 1 2 3

It will be read in to a vector for each column, and can be a matrix of any size.
My question is how do I go about reading the input up to the ; for each vector?

Thanks for any help.
Last edited on
1
2
3
4
5
6
7
std::string row;
std::getline(line, row, ';');

std::istringstream foo(std::move(row));
double n;
while(foo>>n)
   //... 
Last edited on
Topic archived. No new replies allowed.