title: c++ 2d array maze navigation
body: <p>I'm new to c++ and wondering if I'm doing this the best way. I need to read in a line from a text file and build an array from it and then navigate it. Let me know if I'm doing something wrong. Can I access matrix the way I am?</p>
  
  <p>header:</p>
  
  <pre><code>#ifndef MAZE_HPP_
  #define MAZE_HPP_
  
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  
  class Maze
  {
  public:
      Maze(int size);
      ~Maze() {}
  
      enum Direction { DOWN, RIGHT, UP, LEFT };
  
      // Implement the following functions:
  
      // read maze from file, find starting location
      void readFromFile(std::ifstream &amp;f);
  
      // make a single step advancing toward the exit
      void step();
  
      // return true if the maze exit has been reached, false otherwise
      bool atExit();
  
      // set row and col to current position of 'x'
      void getCurrentPosition(int &amp;row, int &amp;col);
  
      // You can add more functions if you like
  private:
      // Private data and methods
      int size;
      static string matrix[30][30];
  };
  
  
  #endif /* MAZE_HPP_ */
  </code></pre>
  
  <p>c++ file:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "maze.hpp"
  #include "utils.hpp"
  #include &lt;vector&gt;
  #include &lt;string&gt;
  
  Maze::Maze(int size) {
      size = size;
  }
  
  Maze::void readFromeFile(std::ifstream &amp;f) {
      std::string line;
      int i, j;
      while(std::getline(f, line)) {
          for(i = 0; i &lt; line.length(); i++) {
              for(j = 0; j &lt; line.length(); j++) {
                  matrix[i][j] = line.at(j);
              }
          }
      }
  }
  
  Maze::void step() {
  
  }
  
  Maze::bool atExit() {
  
  }
  
  Maze::void getCurrentPosition(int &amp;row, int &amp;col) {
  
  }
  </code></pre>