You can use a stringstream to split the string.
Is it compulsory to use arrays - vectors would be a better choice?
BTW the strings are numbers why don't read them as int ?
Will there always be just two rows, or an unknown number?
I presume the first number (6) is the number of columns?
All of your strings appear to be integers. Are you sure you want to treat them as strings, or would they be better as integer or double (floating-point) type?
I played around with the same idea a little bit, but this isn't really much different from what has already been said.
As already suggested, I'm not sure whether the data should be strings or integers, so I left that option open. Use string or int or double at line 11 according to taste.
There will always be three lines and the number in the first line is the number of the contents of each of the following lines.
I’m not sure that answers Thomas1965’s questions and all Chervil’s ones:
Question 1:
Thomas1965 wrote:
Is it compulsory to use arrays - vectors would be a better choice?
Question 2:
Thomas1965 wrote:
BTW the strings are numbers why don't read them as int ?
Question 3:
Chervil wrote:
All of your strings appear to be integers. Are you sure you want to treat them as strings, or would they be better as integer or double (floating-point) type?
I’m afraid very often, when they see their sensible requests for details being disregarded, even easy going people became reluctant to give further help.