C++ text file with columns into 2D vector
问题 I have a text file that has values and I want to put them into a 2D vector. I can do it with arrays but I don't know how to do it with vectors. The vector size should be like vector2D[nColumns][nLines] that I don't know in advance. At the most I can have in the text file the number of columns, but not the number of lines. The number of columns could be different, from one .txt file to another. .txt example: 189.53 -1.6700 58.550 33.780 58.867 190.13 -3.4700 56.970 42.190 75.546 190.73 -1.3000