All pastes #968244 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-02 22:17 UTC
rendered paste body
#include <iostream>
#include <string>

using namespace std;

int main (){
 
 double slength, half, i, j;
 string astring;

 cout << "Please enter in your word: ";
 cin >> astring;

 slength = astring.length() - 1;

 half = slength / 2.0;



 i=0;
 j= slength;

 while (i < half){


  if( astring.substr(i) != astring.substr(j)){

   cout << "Not a palindrome";
    return 1;
  }

 i++;
 j--;
 }

 cout << "yes it is a palindrome";
 



return 0;
}