Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. bool testPalindrome(const string & str)
  2. {
  3.     int i=0;
  4.     int j=0;
  5.     bool ok=true;
  6.     i=chaine.size() - 1;
  7.     while (j <= i && ok)
  8.     {
  9.         if (chaine[i] == chaine[j])
  10.         {
  11.             i--;
  12.             j++;
  13.         }
  14.         else
  15.         {
  16.             ok = false;
  17.         }
  18.     }
  19.     if (ok)
  20.     {
  21.         return true;
  22.     }
  23.     else
  24.     {
  25.         return false;
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement