title: homework:Bankers Algorithm,read matrix txt file
body: <p>Bankers algorithm: I am trying to read from txt file into 4 variables. allocation,Max matrix/ available and request vectors. i am stuck as to how to read it properly. The txt file first value is number of process and 2nd value is resources, the first matrix is allocation and 2nd matrix is Max, then lastly 2 vectors.this is what i have so far  </p>
  
  <p>this is the txt file:</p>
  
  <p>5</p>
  
  <p>4</p>
  
  <p>0 0 1 2<br>
  1 0 0 0<br>
  1 3 5 4<br>
  0 6 3 2<br>
  0 0 1 4</p>
  
  <p>0 0 1 2<br>
  1 7 5 0<br>
  2 3 5 6<br>
  0 6 5 2<br>
  0 6 5 6  </p>
  
  <p>1 5 2 0  </p>
  
  <p>1:0 4 2 0  </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  
  
  int main(int argc, char *argv[])
  {
  ifstream mFile;
  mFile.open("s1.txt");
  vector&lt;int&gt; request[],available[];
  int allocation[][],Max[][];
  int m,n;
  vector &lt;int&gt; work,finish;
  work = available;
  
  mFile &gt;&gt;m &gt;&gt;n;
  while(!mFile.eof())
  {
  
  for(int i=0; i&lt; m; i++)
  {
  for(int j =0;j&lt;n;j++)
  {
      mFile &gt;&gt; allocation[i][i];
      mFile &gt;&gt; Max[i][j];
      request[i][j] = Max[i][j] - allocation[i][j];
  
  }
  } 
  }   
  
  
  mFile.close();
  }
  </code></pre>