I need help in reading the next line of a file in CPlusPlus. Suppose this is the input file.
12345
67890
I want the output:
In array1 = 123
In array2 = 678
int array1[10], array2[10];
int n, i=0;
ifstream x;
x.open("input.txt", ios::in)
while( (!x.eof()) || (i<3) )
{
x >> n;
array1[i] = n;
i++;
}
//here should be the command for next line
i = 0;
while( (!x.eof()) || (i<3) )
{
x >> n;
array2[i] = n;
i++;
}
x.close();