title: c++ palindrome program using array
body: <p>I am having a problem with my palindrome program. I am required to use arrays and show how a push and pop would work without .push or .pop. The trouble I am having is when I enter a 3 letter word it will say yes it is a palindrome but if I enter a word that is 4 or more characters it will say not a palindrome even if it is. ex. kayak. Dont see where I am going wrong. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
      char original[13];
      int stkptr=-1;
      int x = strlen(original)-1;
  
  
      cout &lt;&lt;"Enter a character"&lt;&lt;endl;
  
      for( ++stkptr ; stkptr&lt;13;stkptr++)
      //store user input into the array
      {
  
          cin&gt;&gt;original[stkptr];
  
          if(original[stkptr]=='0')
              break;
  
          cout&lt;&lt;original[stkptr]&lt;&lt;"  Stack pointer is: "&lt;&lt;stkptr&lt;&lt;endl;
  
  
  
      }
      //POP
      for (--stkptr; stkptr&gt;=0;stkptr--)
          cout&lt;&lt;original[stkptr]&lt;&lt;" Stack pointer is: "&lt;&lt;stkptr&lt;&lt;endl;
  
  
  
      for(int i = 0; i &lt;= x; i++)
      {
          if (original[i] == original[x-i])
          {
              continue;
          }
          else
          {
              cout&lt;&lt;"\nNot a palidrome\n"&lt;&lt;endl;
              system("pause");
              return 0;
          }
      }
  
      cout &lt;&lt; "\nIndeed Palidrome\n"&lt;&lt;endl;
      system("pause");
      return 0;
  }   
  </code></pre>