Just wonder, for a matrix stored in a file as what it is, i.e. each line in the file being a row of the matrix where elements are separated by space(s), how can I predetermine the size of the matrix, then create an array of the same size and read it into the array in C and C++? If you have some code example, that would be appreciated!
Thanks and regards!
Something like this. You need to include vector, sstream and string.
There is no need to find out the size of the vector in advance.