title: C++ .exe has stopped working - error in code
body: <p>I wrote a small program in c++, and it doesn't have any error on compile time but when I run the program, I'm facing with an error.
  Following is my code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  #include &lt;sstream&gt;
  #include &lt;stack&gt;
  #include &lt;queue&gt;
  
   #include "QueType.h"
   #include "StackType.h"
   #include "tools.hpp"
  
   #include &lt;locale&gt;
  
   #include &lt;list&gt;
  
   using namespace std;
  
  
  
   bool isPalindrome(const string&amp; stringToCheck)
   {
   string line2;
   bool pal;
   string wrdF;
   stack&lt;char&gt; word1;
   queue&lt;char&gt; word2;
  
   char x,y;
  
   line2=stringToCheck;
  
  // make lowercase
  for (size_t j=0; j&lt; line2.length(); ++j)
  {
  line2[j] = tolower(line2[j]);
  }
  
  std::locale loc;
  std::string str = line2 ;
  std::string::size_type al=0;
  
  wrdF = "";
  std::string::size_type al2 = 0;
  while ( (al&lt;str.length())  ) {
  
    if (std::isalnum(str[al])) {
        wrdF += str[al];
  
        al2++;
    }
  
    ++al;
   }
  
  ItemType* items = new ItemType[al2]; 
  strcpy(items,wrdF.c_str());
  
  int oo=(int)al2;
  for (int q=0;q&lt;oo ;q++)
  {
  if (items[q] != ' ') {
      word1.push(items[q]);
      word2.push(items[q]);
   }
  }
  pal = true;
  while (!word1.empty() &amp;&amp; !word2.empty())
  {
      x=word1.top();
      y=word2.front();
      if (x != y)
      {
          cout &lt;&lt; "No palindrome" &lt;&lt; endl;
          pal=false;
  
          break;
      }
      else
      {
          word1.pop();
          word2.pop();
      }
  
  }
  
  if (pal == true)
      cout &lt;&lt; " palindrome" &lt;&lt; endl;
  
  return(pal);
  
  }
  
  
   int main()
    {
  
   int row=0;
   string line;
   bool pali;
   ifstream myfile ("palindrome-testfile.txt");
  
  ofstream palin("palindromes.log");
  ofstream nopalin("nopalindromes.log");
  
  if (myfile.is_open())
  {
  
   while ( getline (myfile,line) )
   {
  
   //      cout &lt;&lt; line &lt;&lt; '\n';
    ++row;
   //      cout&lt;&lt;row&lt;&lt;". ";
  
  
   pali= isPalindrome(line);
  
  
   if (pali)
   {
      palin &lt;&lt; line &lt;&lt; endl;
   }
   else
   {
      nopalin &lt;&lt; line &lt;&lt; endl;
   }
   }
  
   myfile.close();
   }
  
   else cout &lt;&lt; "Unable to open file";
  
   return 0;
   }
  </code></pre>
  
  <p>Please help me to resolve it. Thanks in advance.</p>
  
  <p><a href="https://i.stack.imgur.com/vxEDT.png" rel="nofollow noreferrer">Capture of error</a></p>