Hello,
In c++ I need to read a file of the format
number (spaces) number (spaces) number
number (spaces) number (spaces) number
into an array/vector of the form array[length of file][3] where the amount of spaces between numbers is variable. I'm trying to do this using the getline function and reading in the numbers as strings but can't seem to make it loop so that on the end of the line it uses a '\n' instead of ' '. I've tried using an ifelse combination of the form
 if (j==2)

{

y='\n';

}

else

{

y=' ';

}

and then placing y in the getline command


for (i=0;i<=1;i++)

{

for (j=0;j<=2;j++)

{

getline (cin,a[i][j],y);

}

}
Furthermore how best to deal with the variable number of spaces, in this example i've only been using one space.
Thanks.