Here is the input file.
12345
67890
I want 123 in array1.
I want 678 in array2.

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();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.