title: How can I get the second and last characters of a line for an input file and compose array in C++?
body: <p>I have an input.txt file, I am trying to read input file by line and I want to compose 2 arrays. First line after space gives the size of the array. Size of the array is 3 for my example input file which is below. From second line after first space till end of the file composes array A[]. For this example A[3]={5,8,14} From Second line after second space till end of the input file composes content of array B[]. It is B[3]={67,46,23} for this input file. After first line first numbers of every line is just gives the line number of each line.Input file is like that:</p>
  
  <pre><code>10 3
  1 5 67
  2 8 46
  3 14 23
  </code></pre>
  
  <p>Here is the below my start code. How can I get the second and last characters of a line for an input file? </p>
  
  <pre><code>#include&lt;stdio.h&gt; 
  #define N 128
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  int A[N];
  int B[N];
  
  int main(){
  
      ifstream fin;
      fin.open("input.txt", ios::in);
  
      char CHARACTER;
      int ITEMNUMBER = 0;
  
      while (!fin.eof() ) {
  
      fin.get(CHARACTER);
          if (CHARACTER== '\n'){
              ++ITEMNUMBER;
          }       
  
      }
      printf("\n");
      cout &lt;&lt; "NUMBER OF ITEMS: " &lt;&lt; ITEMNUMBER&lt;&lt; endl; 
  
  return 0;
  }
  </code></pre>