title: C++ Wordsearch Puzzle Grid 2D Array
body: <p>I'm having an issue trying to read in a textfile (below) that contains letters for a wordsearch. I want to read the textfile in as an array then be able to match the words from my <em>dictionary.txt</em> to the <em>wordsearch_grid.txt</em>. Any ideas?</p>
  
  <pre><code>wordsearch_grid:
  9
  E M M A R G O R P 
  C L U A U N L L D 
  O T A O F I L O I 
  M E U N J G E O K 
  P W H K G G H P Q 
  I C O M P U T E R 
  L L V R Z B A O X 
  E H O M L E Q G U 
  T N I R P D C O E
  
  dictionary:
  COMPILE
  COMPUTER
  DEBUGGING
  HELLO
  KITCHEN
  GRAPHICS
  LOOP
  SPAN
  PROGRAMME
  WORLD
  </code></pre>
  
  <p>The code I have so far is as follows:</p>
  
  <pre><code>#include "WordSearch.h"
  #include "fstream"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "vector"
  
  
  using namespace std;
  
  vector&lt;string&gt; list;
  vector&lt;string&gt; grid;
  string line;
  string n;
  
  WordSearch::WordSearch(const char * const filename) 
  {
  
  
  }
  
  WordSearch::~WordSearch() 
  {
  
  }
  
  void WordSearch::ReadSimplePuzzle() {
  
      ifstream inFile;
      inFile.open("wordsearch_grid.txt");
  
      if (inFile.fail())
      {
          cerr &lt;&lt; "Error Wordsearch Grid File" &lt;&lt; endl;
          exit(1);
      }
      else
      {
  
          while (getline (inFile, n))
          {
              cout &lt;&lt; n &lt;&lt; endl;          
          }
          //grid[4][3];
          inFile.close();
          //cout &lt;&lt; grid &lt;&lt; endl;
          cout &lt;&lt; "\n" &lt;&lt; endl;
      }
  
  }
  
  void WordSearch::ReadSimpleDictionary() 
  {
      ifstream inFile;
      inFile.open("dictionary.txt");
  
  
      if (inFile.fail())
      {
          cerr &lt;&lt; "Error Dictionary File" &lt;&lt; endl;
          exit(1);
  
      }
      else
      {
          int count = 0;
          while (getline(inFile, line))
          {
              list.push_back(line);
              cout &lt;&lt; line &lt;&lt; endl;
          }
          inFile.close();
      }
  
  
  }
  
  void WordSearch::SolvePuzzleSimple() 
  
  {
  
  
  }
  </code></pre>
  
  <p>So far it can read in the files and display them but I want to be able to manipulate the grid so that it I can match the first and last letter of say "COMPILE" to match up with 2 letters in the grid and output to output.txt "COMPILE was found at [1][2]</p>